|
you'll need to edit your post to make sure all the <'s and >'s show up. as it is now, we can't tell how you've declared the vectors.
Cleek | Image Toolkits | Thumbnail maker
-- modified at 10:04 Saturday 10th September, 2005
|
|
|
|
|
|
I have created a SDI application (with no Document/View) support. I 'm trying to attach a CBitmap button, but dose not displayed at all.
Here is my code (that handles the WM_CREATE message on the CChildView class):
<br />
int CChildView::OnCreate(LPCREATESTRUCT lpCreateStruct)<br />
{<br />
if (CWnd::OnCreate(lpCreateStruct) == -1)<br />
return -1;<br />
<br />
RECT rect;<br />
rect.left = 20;<br />
rect.right = rect.left + 20;<br />
rect.top = 100;<br />
rect.bottom = rect.top + 20;<br />
<br />
CBitmapButton bnPlay;<br />
if(bnPlay.Create(NULL, WS_CHILD|WS_VISIBLE|BS_OWNERDRAW, <br />
CRect(&rect), this, IDC_BN_PLAY)==0)<br />
{<br />
AfxMessageBox("BnPlay cannot be created", MB_ICONSTOP);<br />
return -1;<br />
}<br />
<br />
bnPlay.LoadBitmaps(IDB_BNPLAY);<br />
bnPlay.SizeToContent();<br />
return 0;<br />
}<br />
The result of this code is an empty window...
|
|
|
|
|
|
I have created a CBitmapButton in the main window of an SDI application, but I can't figure out how to implement the button. I would like to use it to open a dialog. Here is the code I used to create the button. Thanks for any help you can give.
RECT rc;
rc.top=10;
rc.left=10;
rc.right=95;
rc.bottom=95;
CBitmapButton *Winbut = new CBitmapButton;
Winbut->Create(NULL,WS_CHILD|WS_VISIBLE|BS_OWNERDRAW,rc,this,IDB_SITBUT);
Winbut->LoadBitmaps("SITEIMAGEU","SITEIMAGED","SITEIMAGEU","SITEIMAGEX");
Winbut->SizeToContent();
|
|
|
|
|
The last parameter of the create function is the ID of the control you are creating. It is an integer.
Let it be 200.
Then declare a function in the header for the class.
afx_msg void OnButtonWhatever();
In the message map in the .cpp file:
...<br />
...<br />
ON_COMMAND(200,OnButtonWhatever)<br />
END_MESSAGE_MAP()
Then implement the function:
void [Your Class Name Here]::OnButtonWhatever()<br />
{<br />
MessageBox("The button was clicked. He He!");<br />
}
this is this.
|
|
|
|
|
Thanks for the help. Worked like a champ.
|
|
|
|
|
hi all,
i am trying to export a class template from a static library using __declspec(dllexport). The library will compile fine, however importing it into my second project and attempting to instantiate it produces a number of unresolved external symbol linker errors, for each method. Is it possible to export templates from a static library?
|
|
|
|
|
you need to provide the entire definition of the template, in order to 'export' it. a template is not a class - it's just a recipe that the compiler uses to make a real class. any compiler using your lib will need the whole template definition to build that class.
this[^] might help.
Cleek | Image Toolkits | Thumbnail maker
-- modified at 16:50 Friday 9th September, 2005
|
|
|
|
|
thanks for the link. so, there is no way to export the actual template, so that clients can recreate the templates with any types they need? What i am basically looking for is a way to reuse class templates in multiple projects. any suggestions?
|
|
|
|
|
|
thanks, that link explains why it doesn't work. so, tbe answer is no? oh well, i'll figure something out
|
|
|
|
|
zildjohn01 wrote:
so, there is no way to export the actual template, so that clients can recreate the templates with any types they need?
put the template in a .H file and let anyone who wants to use your template #include that .H file.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
good afternoon,
The memory leak report looks like this:
{404} normal block at 0x00FD8CD8, 49995 bytes long.
Data: < > 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
{399} normal block at 0x00FD8770, 1309 bytes long.
Data: 48 65 61 64 65 72 20 4C 65 6E 67 74 68 3A 20 30
{166} normal block at 0x00FBDAC0, 14844 bytes long.
Data: <5 a p > 35 00 00 00 90 D2 61 00 70 81 13 00 00 00 00 00
c:\dev\c++\billing\voldisc\voldiscdlg.cpp(592) : {147} normal block at 0x00E25028, 64 bytes long.
Data: < > CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD
the Last part with all CDCDCDCDCDC seem like unintinized object, but it looks alright in the code,
DiscountData = new DISCOUNTDATASTRUC;
what about all the 20202020202020, it has 49995 bytes long.......is it the leak size? this application works, but it has all the memory leak..
thanks.
|
|
|
|
|
valerie99 wrote:
the Last part with all CDCDCDCDCDC seem like unintinized object,
Right, it is an uninitialized object and is used for debugging purposes. You can see it, and others, in dbgheap.c . Initialize all of your pointers to NULL .
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
thanks for your reply,
"it is an uninitialized object and is used for debugging purposes", do you mean this should not effect the release version of the program? it seems like stop and didn't create the report when I ran debug version ....
|
|
|
|
|
valerie99 wrote:
The memory leak report looks like this:
{404} normal block at 0x00FD8CD8, 49995 bytes long.
If you can run the program in the same exact way, you can put this:
_CrtSetBreakAlloc(404);
in the beginning of the program (where 404 is the number in brackets above) to get the program to break when it allocates the memory that doesn't get freed. I put mine at the beginning of my app's InitInstance. That might tell you something; I've found it to be a very useful tool. But like I said, it needs to be run in the exact same way so that the number doesn't change.
|
|
|
|
|
thanks for the command, I have tried this tip on my APP's InitInstance, it stop at the DBGHEAP.C, when I look at the call stack, it hit this part of code int nResponse = dlg.DoModal();, and the least are MFC stuff......couldn't really tell where it cause the problem
it brought up another question, all the numbers inside {}, some of them are connected next by each other, like 191, 192, 193, is it means one uninitized pointer causing couple crashes or something like that? I don't really know how to read this. thanks again!
|
|
|
|
|
|
valerie99 wrote:
c:\dev\c++\billing\voldisc\voldiscdlg.cpp(592)
You are calling new on this line, and there is no matching delete to match it.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
that works!
more question ......what about this :
{435} client block at 0x00FC27A8, subtype 0, 28 bytes long.
a CPtrList object at $00FC27A8, 28 bytes long
{434} normal block at 0x00FD8400, 40 bytes long.
Data: <binaryfield> 42 69 6E 61 72 79 46 69 65 6C 64 00 00 00 00 00
c:\dev\c++\billing\voldisc\voldiscdlg.cpp(1169) : {433} normal block at 0x00FD8158, 612 bytes long.
Data: < a P W > DC AE 61 00 50 8B FD 00 57 04 00 00 0C 00 00 00
and the 202020202020.......thank you and have a greatweekend!
|
|
|
|
|
Just double click on the "c:\dev\c++\billing\voldisc\voldiscdlg.cpp(1169)" line and it will take you to the leaky object.
He is smart. He will make our Windows go.
|
|
|
|
|
Hello gurus,
I'm currently rewriting a 20 years old 2D game. The game I rewrite is BubbleBobble for the TI-68K platform in standard C (C99). I ask my questions on this forum because it might interest other people and I don't know where to find the answers.
I would like to know where I can get information about old fashion 2D games programming for the following things:
- Physics of sprites:
* Jumping of sprites with detection of elements of the map (player, ennemies and bosses)
* Collision detection between sprites of different natures and sizes (player/ennemy/bubbles)
* Collision detection with the elements of the map (mainly walls)
- AI:
* Tracking algorithms with path-finding: that is ennemies follows the player and avoid obstacles when encounting them
* sentinel movements
Thanks in advance for the help.
Best regards.
There is no spoon.
|
|
|
|
|
you have to make a sprite manager for sprite collision, etc...
buy a book something like Game programming in 24h or lesson it`s a good book of 2D game programming
|
|
|
|
|
There are lots of game programming sights on the net that have tons of code for doing every thing you are looking for.
Some good keywords to search for: Graphics, Gems.
"Graphics Gems" are a series of books on graphics algorithms, and the code is online.
There's also another series of books with "Gems" in the title that covers: graphics, AI, collision detection, sprite management, ect...
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|