Questions tagged [winmain]

WinMain is the user provided entry point for graphical Windows based applications.

WinMain is the user provided entry point for graphical Windows based applications. It is used as an entry point in every such Windows application. WinMain is used to initialize the application, display its main window, and enter a message retrieval-and-dispatch loop that is the top-level control structure for the remainder of the application's execution.

125 questions
9
votes
1 answer

Undefined reference to WinMain@16 when using SDL

I've been having a lot of trouble getting everything working so that I can start developing on Windows, as apposed to Linux, which is what I normally use when coding. I'm having a rather bizarre issue when trying to compile an SDL program. As soon…
Velovix
  • 527
  • 1
  • 6
  • 19
8
votes
3 answers

How do I set WinMain as entry point?

I've deleted the _tmain() method which the IDE generated because I find no sense having two entry points after adding my WinMainentry. And yes, this is my first ever C++ application and I am a newbie, but please be nice. So that's all I got: //…
David von Tamar
  • 797
  • 3
  • 12
  • 29
7
votes
3 answers

How does MFC's wWinMain end up in the executable?

In MFC, wWinMain is defined in appmodul.cpp. This file is built into mfc90ud.dll from what I can see. However, when I run my application, the call stack shows MyApplication.exe!wWinMain. How has it taken the wWinMain function that was exported in…
Mark Ingram
  • 71,849
  • 51
  • 176
  • 230
7
votes
2 answers

why doesn't winmain set the errorlevel?

Why does this program correctly display a message box, but does not set the error level? int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int …
Brian R. Bondy
  • 339,232
  • 124
  • 596
  • 636
7
votes
5 answers

undefined reference to SDL_Init

I started using SDL today and had some trouble before, now I got it running but it won't let me init it. This is my code: #include #include "SDL.h" #undef main using namespace std; int main(){ if(SDL_Init(SDL_INIT_EVERYTHING)<0){ …
miquel09
  • 144
  • 1
  • 1
  • 12
6
votes
1 answer

What set's the nShowCmd parameter of WinMain?

This seems a little strange that i can't find anything about it, but what actually sets the nShowCmd parameter of WinMain? I know what it does, and i know i can set it for windows I create, but when my program starts execution in WinMain, how is the…
iedoc
  • 2,266
  • 3
  • 30
  • 53
6
votes
0 answers

undefined reference to WinMain@16 C++

I'm learning in C++, and I've been watching tutorials on thenewboston.org. I'm trying to place classes in different files. When compiling in Codeblocks, I get the message, "undefined reference to WinMain@16". This is my code: Burrito.cpp …
Relopz
  • 61
  • 1
  • 1
  • 2
4
votes
1 answer

Assembler: Getting Win32's WinMain on-stack parameters

I need to access the WinMain parameters using assembly, but I don't seem to be able to do so despite that I supposedly know where they are in the stack (DWORD offsets 0 to 16, and 0 to 20 when pushing EBP before operations). Below there's an example…
alt.126
  • 1,097
  • 1
  • 9
  • 22
4
votes
2 answers

Where are WPRFLAG and _WINMAIN_ macros defined?

You know, there are codes like #ifdef WPRFLAG and #ifdef _WINMAIN_ in ctrexe.c . I'm using vs2010) These macros determine what function is called from entry point. But I can't find these macros even in the macro settings of project setting. Where…
ssss
  • 41
  • 1
  • 4
4
votes
0 answers

Nothing printing to stdout from WinMain - C/VS 2017

I should preface with the fact that I'm relatively new to VS, however I am not new to C. The problem I'm encountering is that nothing shows up on stdout when printed. Neither printf/_s, nor fprintf/_s(stdout, ...) produce any output. Interestingly…
mpchenette
  • 127
  • 1
  • 1
  • 4
3
votes
2 answers

Error when statically building a windows application

I have an application that compiles and works fine when I dynamically link everything, but when I want to have a static build of it, it will not compile. In Visual Studio 2010, I set the "Use MFC in a Static Library" option. When I do that, I get…
Jason
  • 31
  • 2
3
votes
1 answer

WinMain compiles, but wWinMain does not in CodeBlocks

So I'm trying to create a window in CodeBlocks using Win32, and so far only this version of WinMain works ( note: this is just a simple and naive example ): #include INT WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,…
user4492811
2
votes
1 answer

What does creating a Solution using a template in Visual Studio actually do versus an empty project?

I am following the Intro to C tutorial by Molly Rocket but am running into an issue running the following code in the Debugger in VisualStudio 2019 while using the Empty Project option. I am using the Empty Project option instead of loading a…
BornGeek
  • 58
  • 1
  • 9
2
votes
0 answers

Including SDL.h causes program to terminate immediately after building, and not run, but not give an error

This test program should create a blank window that stays open until you x-it-out. I copied it from SDL's documentation to make sure it is correct. It can be found here. // Example program: // Using SDL2 to create an application window #include…
Cole T
  • 29
  • 3
2
votes
1 answer

Console is still shown with WinMain entry point in C++ using Netbeans

I'm trying to make a small application which starts another application depending on command line parameters. I am using the WinMain entry point like this: BOOL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR commandLine, int nCmdShow)…
MC Emperor
  • 22,334
  • 15
  • 80
  • 130
1
2
3
8 9