|
Hi all,
I created array with COleSafeArray ...
Now, i don't know how to destroying that !
Clear or Destroy or DestroyData ?
Which one ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
If it's just going out of scope, then you surely don't need to do anything - the destructor should take care of it for you. If you want to reuse the array, then DestroyData looks like a winner, if you want to kill the existing array as well as everything in it, then Destroy() will do the trick.
If you're using MFC then you can run in debug mode (F5) and when you close VC will let you know of any memory leaks, so if that is your concern ( for example, it's a COleSafeArray*), then that is a good way to see if you've leaked memory or not.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Hi, All.
=======
I have an API console application.
Does anyone know if I can and how to change/set the icon ?
BTW: come to #CodeProject on DalNet (mIRC)
|
|
|
|
|
If you need to support many Windows flavours then give this a try;
TCHAR szTitle [ 1024 ];
::GetConsoleTitle ( szTitle, 1024 );
HWND hWnd = ::FindWindow ( NULL, szTitle );
if ( NULL != hWnd ) {
HICON hIcon = ::LoadIcon ( ::GetModuleHandle ( NULL ),
MAKEINTRESOURCE ( IDI_MY_ICON ) );
if ( NULL != hIcon ) {
::SendMessage ( hWnd, WM_SETICON, FALSE,
reinterpret_cast<LPARAM>( hIcon ) );
}
}
Ofcourse you'll want to play nice and free the icon resource when your done, but you get the idea.
If your using Win2K you should take a look at GetConsoleWindow function and use it to replace the FindWindow code listed above (because depending on the console's title the above code might no always work as expected).
cheers,
Ben Burnett
"It's all absolutely devastatingly true -- except the bits that are lies"
- Douglas Adams
|
|
|
|
|
|
Almost forgot...
Because I'm using a console application I prefer not using resources,
I think I would like to load it from a file.
I'm not checking the MSDN, 'cause... I'm lazy I guess.;)
If you can help me, ... Thanks.
BTW: come to #CodeProject on DalNet (mIRC)
|
|
|
|
|
::LoadImage is what you want.
HANDLE LoadImage(
HINSTANCE hinst,
| LPCTSTR lpszName,
UINT uType, = IMAGE_ICON
int cxDesired, = 0
int cyDesired, = 0
UINT fuLoad ); = LR_LOADFROMFILE | LR_DEFAULTSIZE
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Thank you guys, for helping me.
BTW: come to #CodeProject on DalNet (mIRC)
|
|
|
|
|
From MSDN:
Note Because the Win32 message LB_ITEMFROMPOINT works only with Windows 95, ItemFromPoint, which wraps the Win32 message also works only with Windows 95.
I am using Win98 and it works fine, does this function work with NT/2000/XP and if not, what is the alternative?
---
Blessed are those who can laugh at themselves, for they shall never cease to be amused
|
|
|
|
|
Works fine under Windows 2000. The possibility that a message would be removed ( thus breaking software for newer OS's ) seems odd to me. I reckon you're probably pretty safe to use it.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
I am trying to find the current directory of my application on a HPC2000 operating system using Visual C++ 3.0 Embedded. The function GetCurrentDirectory does not seem to exist for the embedded environment. Anybody solve this problem, or have any hints to get me started.
Don
|
|
|
|
|
Not sure if this is what you're after, but it will get you the dir that your exe is in. Ive tested this on a PocketPC device. I dont have any HPC's available atm.
TCHAR szModule[512];
DWORD dwResult = ::GetModuleFileName(AfxGetApp()->m_hInstance, szModule, 512);
if(dwResult == 0) return;
CString strInstallDir = szModule;
int pos = strInstallDir.ReverseFind('\\');
strInstallDir = strInstallDir.Left(pos+1);
|
|
|
|
|
Ooops... the last part was from a non-unicode project.
int pos = strInstallDir.ReverseFind(L'\\');
will fix it.
|
|
|
|
|
As we know, when we click left button of mouse on the menu item of menu bar, it will mapping it with it's handling function. But how could i how could do the same thing with click right button of mouse??
Help~~~
|
|
|
|
|
Why would you want to confuse your users in this way ?
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
I don't think it's possible since WM_COMMAND is fired only for regular left-button clicks. Christian is right though, why do something so weird?
Regards,
Alvaro
|
|
|
|
|
How can I launch a new child frame from a inherited CView class??
|
|
|
|
|
Do you mean a new instance of a CView derived class in an MDI app, or do you mean a new child window that is the child of a CView derived class ?
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
The idea is this:
Now that I've got the communication between my CMouse and CHtlm2View classes, I want that based in some information that my CMouse class give to my View class, launch a new chils windows with another html page displayed on it. I dont' know if this can be done from the View? Or shoul I launch it from the CMainframe class?? Anyway I don't how to do it....
|
|
|
|
|
Your document template ( which is in CMainframe ) has the method CreateNewFrame, which takes a pointer to the document associated with the view and returns a CFrameWnd*. Then you need to call InitialFrameUpdate on the template also, passing in the frame pointer and doc pointer. The best place for this is your document, because you can use theApp global variable to access the template, and 'this' for the document.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Can't use theApp variable. Doesn't recognize it!!
|
|
|
|
|
try putting an extern statement in, if it's an MFC app wizard generated app, then it is there. You can get the app as easily with AfxGetApp() if you need it.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
|
|
|
|
|
Yep it worked! sorry I should do a little research eh?? Anyway tnx
|
|
|
|
|
Hi,
I know how to use the PSI.DLL (was it?) for checking a process' memory usage etc. But how can I get information about each process' CPU usage? I want to include a CPU usage bar in my software to display how much CPU that software is using.
Hints anyone?
|
|
|
|
|
WMI provides that information. I don't remember the specific profider. something like WIN32_Process. There are some examples of exactly what you are trying to do. I saw them while looking for some other WMI code. Just do some searches on google, code guru etc. You'll find them.
Hope this helps,
Bill
|
|
|
|