|
In game.h get rid of
class Player;
because you are not using Player as a pointer and you
#include "Player.h"
in the next line.
John
|
|
|
|
|
Choose[^] any kind you want! Thanks!
Windows Calculator told me I will die at 28.
|
|
|
|
|
I'm a bit slow to reply today, I am sick. Has your problem been solved ? I thought so, from reading the replies, but if not, then yell.
Lord Kixdemp wrote: PS: Christian Graus, do you live here at CP?
Pretty close.
One other possible problem I thought of, does Player have a default constructor ( one that takes no arguments and is public ) ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
From that description, you need to clean up your include situation. For starters, your "includes.h" (analagous to stdafx.h in wizard-generated code) should not be included in other header files, only cpp files. The way it is now, if you're not using precompiled headers, you're seeing much longer compile times than necessary.
|
|
|
|
|
|
Each compiler has predefined symbols specific to it, so you can have conditionally-compiled code for different compilers. For example, VC has _MSC_VER which also tells you the compiler version.
|
|
|
|
|
|
Hi,
I am curious abt shortcuts to copying data from two buffers into one.
let's say I have an integer and a buffer of LPVOID type. Now i want to copy these two, int first and then all contents of LPVOId buffer( size known ) into the buffer supplied by the user(LPVOID type). memcpy or memmove will do only wholesale copy, no way to specify from what byte to start. is there any way other then byte by byte copy??
how do u do this kinda thing anyways?
any pointers will help, thnx
will something like this work
mydata is allocated and is of LPVOID type
myDataSize is UINT and have correct size( hopefully ) of myData
void copy( LPVOID buff, size )
{
memmove_s( buffer, size, (LPVOID)&someint, sizeof(int) );
buff += sizeof( int );
memmove_s( buffer, ( size - sizeof( int ) ), myData, myDataSize );
//return the input pointer to original value
buff -= sizeof( int );
}
//this could be totally laughable thing, but am jsut new to this kinda thing
//please excuse me if this code seems ridiculous
thnx for help.
|
|
|
|
|
yupp it was ridiculous. VOID does not have size so the compiler does not allow pointer aithemetic on it.
Any suggestions please!!!!
|
|
|
|
|
venadder wrote: //return the input pointer to original value
buff -= sizeof( int );
You're not returning anything. A pointer is not a reference. A pointer could be used as a reference, in which case you'd need a double pointer to modify buff so the calling function can see a change. Anyway what you are attempting to do is pointless as you are trying to preseve the original value, but the original value passed in by the calling function can't be changed in your function, you are only operating on a stack copy of the pointer value.
memcpy(buffer, &someint, sizeof(int));
memcpy(((LPBYTE) buffer) + sizeof(int), myData, myDataSize);
|
|
|
|
|
the problem is here
CTyptedPtrList m_ElementList;
instead use this
CTypedPtrList<CObList, CMyObject*> m_ElementList;
you are missing its parameters
Tanvon
the brain behind ...
|
|
|
|
|
code:
// Windows Programming Tutorial Series
#include "stdafx.h"
#include <windows.h>
int WINAPI
WinMain(HINSTANCE hInst,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
MessageBox (NULL, "Hello World! This is my first WIN32 program",
"Lesson 1", MB_OK);
return 0;
}
2 errors:
Linking...
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/a.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
a.exe - 2 error(s), 0 warning(s)
Who can make some suggestions please?
I guess it may be I did not include the lib well.
|
|
|
|
|
The linker thinks this is a console program whose entry point is the main function. You need to tell it that it is a windows program. In the compiler options, preprocess definitions section you will probably see a macro "_CONSOLE" defined. You need to remove that and add in the macro _WINDOWS there.
|
|
|
|
|
when I include this C++ source file into a "Win32 Application" project, it works;
when include it into a "Win32 Console Application" project, it fails;
my question is how to change the settings of the latter to make it work, without creating a new project of Wind32 Application.
I tried include the macro _WINDOWS in the setting->c/c++->preprocess definitions , but it did not work.
|
|
|
|
|
There is obviously more to it than just the macro and I'm not certain what they are exactly.
What I would do is rename the folder your project is in to Lesson1_Old or something like that, create a new project, and then copy the old code files that you changed into the new project's directory (do NOT copy any project files - only .cpp, h, or .rc files) That should be very easy and take only a minute or two.
Sorry I couldn't be more helpful.
BTW - it could be informative to compare the new project files generated with the old ones that do not work.
|
|
|
|
|
I'm just a beginner my self, and in the process of writing my first application.
So this might be a shot in the dark, so to speak...
But are you trying to display a msgbox in a console application?
I was under the impression that that would be more or less impossible (unless you
program the actual code for displaying such a thing).
If you intend to write something in a console application, shouldn't you just print it
to the console?
Console::WriteLine(L"Hello World!");
If you want to use a msgbox, I think you either have to make a Win32 Application or a MFC application?
This is because in an empty Console Application you don't have window handling etc...
Someone please correct me if I'm wrong?
TylerD75
|
|
|
|
|
no, the original poster is trying make a windows app but the linker thinks he wants a console app.
|
|
|
|
|
If that is the case, how come he writes this?
Quote:
<br />
when I include this C++ source file into a "Win32 Application" project, it works;<br />
<br />
when include it into a "Win32 Console Application" project, it fails;<br />
<br />
my question is how to change the settings of the latter to make it work, without creating a new project of Wind32 Application.<br />
<br />
I tried include the macro _WINDOWS in the setting->c/c++->preprocess definitions , but it did not work.
From this I think he's trying to convert a console application into a Win32 Application, without adding the window handling that is automatically added when creating a new Win32 Application Project. This seem a bit strange to me, but as I stated before: I'm a newbee!
Cheers,
TylerD75
|
|
|
|
|
Go to your project's properties.
Configuration Properties > Linker > System > SubSystem
Change from Console to Windows.
|
|
|
|
|
The entry point of a console app is main() not WinMain() . Change it to main() (with the right prototype, of course).
|
|
|
|
|
if you wanna program for win32 application you must drive to functions itself.
1)WinMain 2)WinPorc
try this code :(thanks for Ivor Horton Books. you can download source code & see chapter 7 )
<br />
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,<br />
LPSTR lpCmdLine, int nCmdShow)<br />
{<br />
WNDCLASS WindowClass;
<br />
static char szAppName[] = "OFWin";
HWND hWnd;
MSG msg;
<br />
WindowClass.style = CS_HREDRAW | CS_VREDRAW;<br />
<br />
WindowClass.lpfnWndProc = WindowProc;<br />
<br />
WindowClass.cbClsExtra = 0;
WindowClass.cbWndExtra = 0;
<br />
WindowClass.hInstance = hInstance;
<br />
WindowClass.hIcon = LoadIcon(0, IDI_APPLICATION);<br />
<br />
WindowClass.hCursor = LoadCursor(0, IDC_ARROW);<br />
<br />
WindowClass.hbrBackground = static_cast<HBRUSH>(GetStockObject(GRAY_BRUSH));<br />
<br />
WindowClass.lpszMenuName = 0;
<br />
WindowClass.lpszClassName = szAppName;
<br />
RegisterClass(&WindowClass);<br />
<br />
hWnd = CreateWindow(<br />
szAppName,
"A Basic Window the Hard Way",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
0,
0,
hInstance,
0
);<br />
<br />
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
<br />
while(GetMessage(&msg, 0, 0, 0) == TRUE)
{<br />
TranslateMessage(&msg);
DispatchMessage(&msg);
}<br />
<br />
return msg.wParam;
}<br />
<br />
<br />
long WINAPI WindowProc(HWND hWnd, UINT message, WPARAM wParam,<br />
LPARAM lParam)<br />
{<br />
HDC hDC;
PAINTSTRUCT PaintSt;
RECT aRect;
<br />
switch(message)
{<br />
case WM_PAINT:
hDC = BeginPaint(hWnd, &PaintSt);
<br />
GetClientRect(hWnd, &aRect);<br />
<br />
SetBkMode(hDC, TRANSPARENT);
<br />
DrawText(<br />
hDC,
"But, soft! What light through yonder window breaks?",<br />
-1,
&aRect,
DT_SINGLELINE|
DT_CENTER|
DT_VCENTER);
<br />
EndPaint(hWnd, &PaintSt);
return 0;<br />
<br />
case WM_DESTROY:
PostQuitMessage(0);<br />
return 0;<br />
<br />
default:
return DefWindowProc(hWnd, message, wParam, lParam);<br />
}<br />
}<br />
<br />
|
|
|
|
|
Drag and Drop Operations between list ctrl and tree ctrl (operations like windows explorer)
please help me
ram
|
|
|
|
|
handle HDN_BEGINDRAG,HDNBEGINTRACK,........
|
|
|
|
|
Hi
check out CDragDropTreeCtrl class. I am sure i downloaded it from code project in first place. It make drag drop very easy to implement if you just look at the code for few minutes, you can implement same drag and drop in list ctrl with very small changes.
If that does not help let me know, if i get time to create a drag drop list control for the tree, i will post it.
|
|
|
|
|
here[^] maybe it is some helpful to you
|
|
|
|
|