Solved Compile successful but no output

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

guru

Coder
Full Member
Nobleman
Jun 8, 2012
115
673
1
Hi guys!
I got a problem in vc++ 2010. I tried a sample program to test the ide. But it compiles successfully without showing any window(which is the desired output). Could you help me debug it?

I am posting my code here!

#include<Windows.h>

HRESULT CALLBACK WndProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam);

int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hprevInstance,LPWSTR cmdline,int cmdshow)
{
UNREFERENCED_PARAMETER(hprevInstance);
UNREFERENCED_PARAMETER(cmdline);
HWND hwnd;
MSG msg;
WNDCLASS wc;
wc.hInstance=hInstance;
wc.lpszClassName=TEXT("Window");
wc.style=CS_VREDRAW | CS_HREDRAW;
wc.hCursor=LoadCursor(0,IDC_ARROW);
wc.hbrBackground=GetSysColorBrush(COLOR_3DFACE);
wc.lpfnWndProc=WndProc;
wc.lpszMenuName=NULL;
RegisterClass(&wc);
hwnd=CreateWindow(wc.lpszClassName,TEXT("Test Window"),WS_OVERLAPPEDWINDOW|WS_VISIBLE,100,100,600,480,0,0,hInstance,0);
ShowWindow(hwnd,cmdshow);
UpdateWindow(hwnd);
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (int) msg.wParam;
}

HRESULT CALLBACK WndProc(HWND hwnd,UINT msg,WPARAM wparam, LPARAM lparam)
{
switch(msg)
{
case WM_CREATE:
{
break;
}
case WM_LBUTTONDBLCLK:
{
MessageBox(hwnd,TEXT("You are not allowed to double click"),TEXT("Info"),MB_OK);
break;
}
case WM_DESTROY:
{
PostQuitMessage(0);
break;
}
}
return DefWindowProc(hwnd,msg,wparam,lparam);
}
 

Fleep

Founder
Meme Tier VIP
May 20, 2012
572
11,023
6
Hey guru, I remember doing a bit of Win32 ide programming a while back, It can be very stressful if your used to C# Ide development work. Anyways I got your code and made a couple of changes, Incase you havent fixed it yet here is the working code, I have commented on the changes I made, not all of them have to be that way but the main ones will be obvious.

If this solves it for you make sure to lock the thread and add [SOLVED] to the topic title.

C++:
#include<Windows.h>

HRESULT CALLBACK WndProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam);

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hprevInstance, /*LPWSTR*/LPSTR cmdline,int cmdshow)
{
  //UNREFERENCED_PARAMETER(hprevInstance);
  //UNREFERENCED_PARAMETER(cmdline);

  HWND hwnd;
  MSG msg;
  WNDCLASS wc;

  wc.hInstance=hInstance;
  wc.lpszClassName=TEXT("Window");
  wc.style=CS_VREDRAW | CS_HREDRAW;
  wc.hCursor=LoadCursor(NULL /*0*/,IDC_ARROW);
  wc.hbrBackground=GetSysColorBrush(COLOR_3DFACE);
  wc.lpfnWndProc=WndProc;
  wc.lpszMenuName=NULL;
  wc.hIcon     = LoadIcon(NULL, IDI_APPLICATION); //WAS MISSING
  //THESE 2 BELOW WERE ALSO MISSING
  wc.cbClsExtra  = 0;
  wc.cbWndExtra  = 0;

  RegisterClass(&wc);
  hwnd=CreateWindow(wc.lpszClassName,TEXT("Test Window"),WS_OVERLAPPEDWINDOW|WS_VISIBLE,100,100,600,480,0,0,hInstance,0);
  ShowWindow(hwnd,cmdshow);
  UpdateWindow(hwnd);


  while(GetMessage(&msg,NULL,0,0))
  {
   TranslateMessage(&msg);
   DispatchMessage(&msg);
  }
  return (int) msg.wParam;
}

HRESULT CALLBACK WndProc(HWND hwnd,UINT msg,WPARAM wparam, LPARAM lparam)
{
  switch(msg)
  {
	  /*
  case WM_CREATE:
   {
   break;
   }
  case WM_LBUTTONDBLCLK:
   {
   MessageBox(hwnd,TEXT("You are not allowed to double click"),TEXT("Info"),MB_OK);
   break;
   }
	 */
  case WM_DESTROY:
   {
     PostQuitMessage(0);
     break;
   }
  }
  return DefWindowProc(hwnd,msg,wparam,lparam);
}

Fleep
 

konsowa

Coder
Full Member
Nobleman
May 24, 2012
178
753
2
If ur ever need to debug anything basically just put a msgbox or 2 which can help u in determining where the problem is..
 

guru

Coder
Full Member
Nobleman
Jun 8, 2012
115
673
1
@Fleep: Thanks fleep! I tried it but can't crack it. I learning this new programming language entirely for programming the hack. Just tried the basics which ever i learned for this week but it's really confusing. I wonder how people use this language. They look like mnemonics to me. People say that this is they efficient way to program hack than any other languages. One more thing fleep, I saw your tutorial you used some of these vc++ elements in the programming. Do I need to be an expert/intermediate level programmer to use it?

@Konsowa: For how many days could I be programming with message box technique to find the bugs even though it's a good idea? For this whole week i used the message box technique to find the bug and fixed it. Moment i tried programming a full length program with message box, I ended with this. Moreover I compare these codes with which I was building successfully this week but no use of it. Quite challenging for me. I am not good at debugging in vc++. And also I don't know what variable should contain what value.


Once I get the basic work in place, I will kick start my hacking work....
 

Fleep

Founder
Meme Tier VIP
May 20, 2012
572
11,023
6
guru said:
@Fleep: Thanks fleep! I tried it but can't crack it. I learning this new programming language entirely for programming the hack. Just tried the basics which ever i learned for this week but it's really confusing. I wonder how people use this language. They look like mnemonics to me. People say that this is they efficient way to program hack than any other languages. One more thing fleep, I saw your tutorial you used some of these vc++ elements in the programming. Do I need to be an expert/intermediate level programmer to use it?

@Konsowa: For how many days could I be programming with message box technique to find the bugs even though it's a good idea? For this whole week i used the message box technique to find the bug and fixed it. Moment i tried programming a full length program with message box, I ended with this. Moreover I compare these codes with which I was building successfully this week but no use of it. Quite challenging for me. I am not good at debugging in vc++. And also I don't know what variable should contain what value.


Once I get the basic work in place, I will kick start my hacking work....
Unless your fairly experienced with c++ then I don't recommend you mess with this as it takes a lot of work to do simple things.
I would recommend sticking to console interfaces in the meantime. Also the VC++ within the tutorial isnt anything difficult, although from my experience it is quite buggy.

Fleep
 

guru

Coder
Full Member
Nobleman
Jun 8, 2012
115
673
1
I would recommend sticking to console interfaces in the meantime
Did you mean console app development?

I will make a list of things that i need to know:
[list type=decimal]
[li]C++ / C#(which would you recommend?)[/li]
[li]directx interfaces[/li]
[/list]

any other thing?

I was in programming for 8 years but never thought about programming system applications or graphics applications. So I need some guidance to a certain point as I am new to this stuff(Don't mistake me fleep if i ask some silly questions. I apologize for that).
 

Fleep

Founder
Meme Tier VIP
May 20, 2012
572
11,023
6
guru said:
I would recommend sticking to console interfaces in the meantime
Did you mean console app development?

I will make a list of things that i need to know:
[list type=decimal]
[li]C++ / C#(which would you recommend?)[/li]
[li]directx interfaces[/li]
[/list]

any other thing?

I was in programming for 8 years but never thought about programming system applications or graphics applications. So I need some guidance to a certain point as I am new to this stuff(Don't mistake me fleep if i ask some silly questions. I apologize for that).
Well before learning C++ I recommend you play around with C#, after getting comfortable with that get used to C++ win32 api.
After that look into D3D Interfaces.

Don't worry about the questions, just start at the easier stuff then move on to heavy c++, also if you wana try out a user friendly interface with C++ then check out [lmgtfy]QT[/lmgtfy], its very similar to Window forms and one of the easiest GUI available for c++.

Fleep
 

guru

Coder
Full Member
Nobleman
Jun 8, 2012
115
673
1
Fleep I know c#. But to what level do I need to know in c# before moving to c++?!! Because my aim is to create an aimbot and esp hack for fps games.

Example: like reading/writing value to the process, creating windows application using c# etc..
 

Fleep

Founder
Meme Tier VIP
May 20, 2012
572
11,023
6
guru said:
Fleep I know c#. But to what level do I need to know in c# before moving to c++?!! Because my aim is to create an aimbot and esp hack for fps games.

Example: like reading/writing value to the process, creating windows application using c# etc..
Well I think if your very comfortable with C# then you shouldn't have a problem with c++.
Why not write a couple of hacks first in C#, then move on to C++.

If you want to create an aimbot as one of your first hacks you can pretty much forget about it as it is crazy.
Here is one of my C# hacking tutorials you may have seen, I did a LONG time ago and with it you get a read/write to memory class and so on. I believe its pretty quick and you may get some help out of it.

https://guidedhacking.com/forum/index.php?topic=14.0

Fleep
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods