User forums > Help

Win API doesn't working

(1/5) > >>

WhiteHat:
Hi everybody,
I have problem with Win API programming in Code::Blocks. I typed really easy Win API source code, Code::Blocks compiled it and made an .exe file. But this file can't be execute. Can You help me pls?

Code, I've typed:

--- Code: ---#include <windows.h>
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,
                                PSTR szCmdLine, int iCmdShow)
{
     MessageBox(NULL, TEXT("Ahoj světe"), TEXT("Programujeme"),0);
     return 0;
}
--- End code ---

Michael:
Hello,

Which C::B revision? Compiler? Not MinGW, because it does not compile you code :).

Which errors did you get?

Best wishes,
Michael

MortenMacFly:

--- Quote from: WhiteHat on June 21, 2006, 10:44:15 pm ---I have problem with Win API programming in Code::Blocks.

--- End quote ---
A few more details would be nice:
- What C::B version are you using?
- What compiler are you using?
- What was your template? (A Windows GUI application, a console application, a file-only)?
- (In case of MSVCTK): do you link against gdi32.lib user32.lib kernel32.lib?
- (In case of GCC): do you link against gdi32 user32 kernel32 windows?
With regards, Morten.
BTW: If you remove your message box it compiles/runs fine for me (with MSVCTK and GCC).
Edit: Ooops, Michael was a few seconds faster than I - but we share the same questions... ;-)

Michael:

--- Quote from: MortenMacFly on June 21, 2006, 11:13:49 pm ---Edit: Ooops, Michael was a few seconds faster than I - but we share the same questions... ;-)

--- End quote ---

But your questions are much more precise and detailed :).

Best wishes,
Michael

WhiteHat:
Well guys, thanks a lot, but I think, I have resolved this problem, as You've said, problem is with compiler (Mingw) Now I had dowbloaded Win32 compiler and everything is OK, only: I have to set build option in every project, how could I set it automaticly?

Navigation

[0] Message Index

[#] Next page

Go to full version