Visual C++ 2008

Visual C++ 2008

offline
  • lnenad  Male
  • Stručni saradnik
    Web
  • Nenad
  • Arhitetak
  • Pridružio: 16 Jan 2007
  • Poruke: 2860
  • Gde živiš: Bijeljina

E ovako, ja sam programer ali do sada nisam nikada u ovom programu radio, imam iskustva sa C++ ali to je do sada uglavnom bilo u radu sa devc++, e sad da pocnem pricu o problemu, napravim program win32 obican i sad (prvi mi je program hocu da napravim digitron (prosto nesto dvije tekst kutije i 4 dugmeta za operacije)) kliknem desnim klikom na folder Source u "solution explorer"-u>add>windows form i sad, nesto me pita da konvertujem projekt u neku stvar, (mislim da nije vazno pa kliknem na ok) i sad napravim ja to sve i sad ne znam da li ja sad taj header fajl da includujem u glavni cpp fajl ili sta i kad includujem prijavljuje nekih milion gresaka a kad ne includujem (stavim da se klikom prikaze messagebox) prijavi gresku

Citat:1>c:\documents and settings\nenad l\my documents\visual studio 2008\projects\digitron\digitron\forma_digitron.h(144) : error C2065: 'NULL' : undeclared identifier
1>c:\documents and settings\nenad l\my documents\visual studio 2008\projects\digitron\digitron\forma_digitron.h(144) : error C2065: 'MB_OK' : undeclared identifier


Moze li mi neko pomoci i objasniti kako se ovo radi...



Registruj se da bi učestvovao u diskusiji. Registrovanim korisnicima se NE prikazuju reklame unutar poruka.
offline
  • Pridružio: 30 Maj 2005
  • Poruke: 1014
  • Gde živiš: Mbabane

Jos kad bi napisao u koju stvar i to sve i sad taj header isto, i to sto include-ujes i sta nije vazno ... mozda bi ti neko i pomogao.

Problema sa kontantama i header-ima u Visual-u ces svakako imati. Ako su ti samo ovo greske, onda definisi sam NULL kao 0,a MB_OK kao neku pozitivnu vrijednost .. mada sumnjam da ce to biti jedine...



offline
  • lnenad  Male
  • Stručni saradnik
    Web
  • Nenad
  • Arhitetak
  • Pridružio: 16 Jan 2007
  • Poruke: 2860
  • Gde živiš: Bijeljina

Ok

Evo sta mi kaze kad ubacim windows form u source
You are adding a CLR component to a native library. Your project will be converted to have common language runtime support.

Izaberem yes i nesto komp obavi ali nisam primjetio neku promjenu u kodu

Glavni source
// digitron.cpp : Defines the entry point for the application. // #include "stdafx.h" #include "digitron.h" #define MAX_LOADSTRING 100 // Global Variables: HINSTANCE hInst;                        // current instance TCHAR szTitle[MAX_LOADSTRING];               // The title bar text TCHAR szWindowClass[MAX_LOADSTRING];         // the main window class name // Forward declarations of functions included in this code module: ATOM            MyRegisterClass(HINSTANCE hInstance); BOOL            InitInstance(HINSTANCE, int); LRESULT CALLBACK   WndProc(HWND, UINT, WPARAM, LPARAM); INT_PTR CALLBACK   About(HWND, UINT, WPARAM, LPARAM); int APIENTRY _tWinMain(HINSTANCE hInstance,                      HINSTANCE hPrevInstance,                      LPTSTR    lpCmdLine,                      int       nCmdShow) {    UNREFERENCED_PARAMETER(hPrevInstance);    UNREFERENCED_PARAMETER(lpCmdLine);     // TODO: Place code here.    MSG msg;    HACCEL hAccelTable;    // Initialize global strings    LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);    LoadString(hInstance, IDC_DIGITRON, szWindowClass, MAX_LOADSTRING);    MyRegisterClass(hInstance);    // Perform application initialization:    if (!InitInstance (hInstance, nCmdShow))    {       return FALSE;    }    hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_DIGITRON));    // Main message loop:    while (GetMessage(&msg, NULL, 0, 0))    {       if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))       {          TranslateMessage(&msg);          DispatchMessage(&msg);       }    }    return (int) msg.wParam; } // //  FUNCTION: MyRegisterClass() // //  PURPOSE: Registers the window class. // //  COMMENTS: // //    This function and its usage are only necessary if you want this code //    to be compatible with Win32 systems prior to the 'RegisterClassEx' //    function that was added to Windows 95. It is important to call this function //    so that the application will get 'well formed' small icons associated //    with it. // ATOM MyRegisterClass(HINSTANCE hInstance) {    WNDCLASSEX wcex;    wcex.cbSize = sizeof(WNDCLASSEX);    wcex.style         = CS_HREDRAW | CS_VREDRAW;    wcex.lpfnWndProc   = WndProc;    wcex.cbClsExtra      = 0;    wcex.cbWndExtra      = 0;    wcex.hInstance      = hInstance;    wcex.hIcon         = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_DIGITRON));    wcex.hCursor      = LoadCursor(NULL, IDC_ARROW);    wcex.hbrBackground   = (HBRUSH)(COLOR_WINDOW+1);    wcex.lpszMenuName   = MAKEINTRESOURCE(IDC_DIGITRON);    wcex.lpszClassName   = szWindowClass;    wcex.hIconSm      = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));    return RegisterClassEx(&wcex); } // //   FUNCTION: InitInstance(HINSTANCE, int) // //   PURPOSE: Saves instance handle and creates main window // //   COMMENTS: // //        In this function, we save the instance handle in a global variable and //        create and display the main program window. // BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) {    HWND hWnd;    hInst = hInstance; // Store instance handle in our global variable    hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,       CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);    if (!hWnd)    {       return FALSE;    }    ShowWindow(hWnd, nCmdShow);    UpdateWindow(hWnd);    return TRUE; } // //  FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) // //  PURPOSE:  Processes messages for the main window. // //  WM_COMMAND   - process the application menu //  WM_PAINT   - Paint the main window //  WM_DESTROY   - post a quit message and return // // LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {    int wmId, wmEvent;    PAINTSTRUCT ps;    HDC hdc;    switch (message)    {    case WM_COMMAND:       wmId    = LOWORD(wParam);       wmEvent = HIWORD(wParam);       // Parse the menu selections:       switch (wmId)       {       case IDM_ABOUT:          DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);          break;       case IDM_EXIT:          DestroyWindow(hWnd);          break;       default:          return DefWindowProc(hWnd, message, wParam, lParam);       }       break;    case WM_PAINT:       hdc = BeginPaint(hWnd, &ps);       // TODO: Add any drawing code here...       EndPaint(hWnd, &ps);       break;    case WM_DESTROY:       PostQuitMessage(0);       break;    default:       return DefWindowProc(hWnd, message, wParam, lParam);    }    return 0; } // Message handler for about box. INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) {    UNREFERENCED_PARAMETER(lParam);    switch (message)    {    case WM_INITDIALOG:       return (INT_PTR)TRUE;    case WM_COMMAND:       if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)       {          EndDialog(hDlg, LOWORD(wParam));          return (INT_PTR)TRUE;       }       break;    }    return (INT_PTR)FALSE; }

Source forme headera
#pragma once using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; namespace digitron {    /// <summary>    /// Summary for forma_digitron    ///    /// WARNING: If you change the name of this class, you will need to change the    ///          'Resource File Name' property for the managed resource compiler tool    ///          associated with all .resx files this class depends on.  Otherwise,    ///          the designers will not be able to interact properly with localized    ///          resources associated with this form.    /// </summary>    public ref class forma_digitron : public System::Windows::Forms::Form    {    public:       forma_digitron(void)       {          InitializeComponent();          //          //TODO: Add the constructor code here          //       }    protected:       /// <summary>       /// Clean up any resources being used.       /// </summary>       ~forma_digitron()       {          if (components)          {             delete components;          }       }    private: System::Windows::Forms::TextBox^  textBox1;    protected:    private: System::Windows::Forms::TextBox^  textBox2;    private: System::Windows::Forms::Button^  button1;    private: System::Windows::Forms::Button^  button2;    private: System::Windows::Forms::Button^  button3;    private: System::Windows::Forms::Button^  button4;    private:       /// <summary>       /// Required designer variable.       /// </summary>       System::ComponentModel::Container ^components; #pragma region Windows Form Designer generated code       /// <summary>       /// Required method for Designer support - do not modify       /// the contents of this method with the code editor.       /// </summary>       void InitializeComponent(void)       {          this->textBox1 = (gcnew System::Windows::Forms::TextBox());          this->textBox2 = (gcnew System::Windows::Forms::TextBox());          this->button1 = (gcnew System::Windows::Forms::Button());          this->button2 = (gcnew System::Windows::Forms::Button());          this->button3 = (gcnew System::Windows::Forms::Button());          this->button4 = (gcnew System::Windows::Forms::Button());          this->SuspendLayout();          //          // textBox1          //          this->textBox1->Location = System::Drawing::Point(50, 42);          this->textBox1->Name = L"textBox1";          this->textBox1->Size = System::Drawing::Size(100, 20);          this->textBox1->TabIndex = 0;          //          // textBox2          //          this->textBox2->Location = System::Drawing::Point(199, 42);          this->textBox2->Name = L"textBox2";          this->textBox2->Size = System::Drawing::Size(100, 20);          this->textBox2->TabIndex = 1;          //          // button1          //          this->button1->Location = System::Drawing::Point(60, 99);          this->button1->Name = L"button1";          this->button1->Size = System::Drawing::Size(75, 23);          this->button1->TabIndex = 2;          this->button1->Text = L"Saberi";          this->button1->UseVisualStyleBackColor = true;          //          // button2          //          this->button2->Location = System::Drawing::Point(215, 99);          this->button2->Name = L"button2";          this->button2->Size = System::Drawing::Size(75, 23);          this->button2->TabIndex = 3;          this->button2->Text = L"Oduzmi";          this->button2->UseVisualStyleBackColor = true;          //          // button3          //          this->button3->Location = System::Drawing::Point(60, 161);          this->button3->Name = L"button3";          this->button3->Size = System::Drawing::Size(75, 23);          this->button3->TabIndex = 4;          this->button3->Text = L"Podjeli";          this->button3->UseVisualStyleBackColor = true;          //          // button4          //          this->button4->Location = System::Drawing::Point(215, 160);          this->button4->Name = L"button4";          this->button4->Size = System::Drawing::Size(75, 23);          this->button4->TabIndex = 5;          this->button4->Text = L"Pomnozi";          this->button4->UseVisualStyleBackColor = true;          this->button4->Click += gcnew System::EventHandler(this, &forma_digitron::button4_Click);          //          // forma_digitron          //          this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);          this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;          this->ClientSize = System::Drawing::Size(376, 311);          this->Controls->Add(this->button4);          this->Controls->Add(this->button3);          this->Controls->Add(this->button2);          this->Controls->Add(this->button1);          this->Controls->Add(this->textBox2);          this->Controls->Add(this->textBox1);          this->Name = L"forma_digitron";          this->Text = L"forma_digitron";          this->Load += gcnew System::EventHandler(this, &forma_digitron::forma_digitron_Load);          this->ResumeLayout(false);          this->PerformLayout();       } #pragma endregion    private: System::Void button4_Click(System::Object^  sender, System::EventArgs^  e) {          MessageBox(NULL, "Klikn na dijeljenje", "Zelite da podjelite", MB_OK);           } private: System::Void forma_digitron_Load(System::Object^  sender, System::EventArgs^  e) {        } }; }

Dopuna: 19 Apr 2008 10:19

E ovako, greska je bila u tome da pri kreiranju treba da izaberem CLR pa Windows form application, i tek onda je sve pravilno linkovano i sredjeno...

Ko je trenutno na forumu
 

Ukupno su 876 korisnika na forumu :: 23 registrovanih, 2 sakrivenih i 851 gosta   ::   [ Administrator ] [ Supermoderator ] [ Moderator ] :: Detaljnije

Najviše korisnika na forumu ikad bilo je 3466 - dana 01 Jun 2021 17:07

Korisnici koji su trenutno na forumu:
Korisnici trenutno na forumu: Andrija357, Doca, DragoslavS, hyla, indja, ivan1973, jackreacher011011, janbo, Koca Popovic, kybonacci, laurusri, LeGrandCharles, ljuba.b, Milos ZA, Miloskec, mnn2, Parker, Rogan33, StefanNBG90, Trpe Grozni, udbas, W123, 125