|
Thanks! That is scary. Could be it, although I've been using the win2000/Norton Antivirus/Visual C++ combo for 3 years now. But I will shutit down now.
|
|
|
|
|
Hi,
Does anyone use a garbage collector in their MFC programs? If no, why not? Anyone with positive or negative experiences? What collector did you use? Thanks.
|
|
|
|
|
Nope. I don't like garbage collector, 'cause I prefer to manage myself the memory I allocate.
We do not inherit the Earth from our ancestors, we borrow it from our children - Antoine de Saint-Exupéry (1900-1944)
|
|
|
|
|
Based on my experience on VC.Net. If I were to use GC in my code.
I will need to wait for the GC to destruct (which is somehow unpredictable unless you write code to explicitly calling the GC). The C++ destructor will just destruct it when it exit the scope.
My code is neater and I know when I exit the scope, everything should be taken care of in the destructor like it will dellocate the pointer and server connection (if i were to place it in destructor) for me so that I have free memory and reusable resources.
This is not the case for using GC. You simply can't tell when is it ready for next operation.
Hope this is useful.
|
|
|
|
|
Hi all,
I am using the default property sheet of the MMC interface.
my question is how to change the property sheet title?
i only implement this method:
STDMETHODIMP CMyNode::CreatePropertyPages(LPPROPERTYSHEETCALLBACK lpProvider,long handle, IUnknown* pUnk, DATA_OBJECT_TYPES type)
{
if (type == CCT_SCOPE || type == CCT_RESULT)
{
HRESULT hr;
CPage1* pPage1 = new CPage1();
hr = lpProvider->AddPage(pPage1->Create());
ATLASSERT(SUCCEEDED(hr));
return S_OK;
}
}
it works ok, i see my page within the property but the title the property gets is the same title is CMyNode....how do i change this default???
thanks in advanced
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Hi,
is there any way how to get around the limit of maximum 64 characters of text in tray icon hint? I know that NOTIFYICONDATA has only 64 byte array, but what about displaying some other tooltip instead of regular tray icon hint that would support longer text?
Thank you for any suggestion.
|
|
|
|
|
no 'real' chance...
try to use an own tooltip window!
Don't try it, just do it!
|
|
|
|
|
Hi..
I made a VB6 DLL FileDownload.NetDown
Now I use this VC++ code to check if the component is registered
LPCLSID cls=0;<br />
HRESULT hr=0;<br />
hr=CLSIDFromProgID((LPCOLESTR)"FileDownload.NetDown",cls);<br />
<br />
if(hr==S_OK)<br />
AfxMessageBox(cls->Data1);<br />
else if(hr==CO_E_CLASSSTRING)<br />
AfxMessageBox("Bad ProgID");<br />
else if(hr==REGDB_E_WRITEREGDB)<br />
AfxMessageBox("Error");<br />
else AfxMessageBox("NONE");
I get the Message (NONE) !!!
I don't Get the Class ID or even an error .. How comes ?
NOTE:
I checked with regedit and the ProgID , ClsID Exist !!
|
|
|
|
|
If you actually check the value of hr, you'll probably find it's E_POINTER (0x80004003), because you're passing a NULL pointer.
You're trying to get CLSIDFromProgID to write into location 0.
The following may work rather better:
CLSID cls = { 0 };
HRESULT hr =
CLSIDFromProgID( OLESTR( "FileDownload.NetDown" ), &cls );
CString sMessage;
if ( SUCCEEDED( hr ) )
{
sMessage.Format( _T( "CLSID(1): 0x%08x" ), cls.Data1 );
}
else
{
sMessage.Format( _T( "ERROR: 0x%08x" ), hr );
}
AfxMessageBox( sMessage ); Key things to learn:- A pointer must point to some allocated space.
LPOLESTR is always a pointer to a Unicode string. Use the OLESTR macro to portably produce a compatible string.HRESULT s can be either success or failure - there are multiple success codes and multiple failure codes. To generically test for success or failure, use the SUCCEEDED and FAILED macros.- The documentation only lists common error codes, it does not show all possible error codes.
Hope this helps.
|
|
|
|
|
Hi! I'm writing an AV player app. So far it works fine on playing single files. However, when I create a 'playlist' and then try to loop through playing each file in turn, files open and load, but then do not play until the last in the list!! The routine runs along the lines of:
for(x=0;x
|
|
|
|
|
It's because you're running this in a loop.. it doesn't wait for the song to play/end, it starts playing the song then goes to the top of the loop and starts all over again until it gets to the last item in the loop.. you need have the loop wait until the song ends or even better yet in your timer function wait until the song ends.. then if another song exists in the playlist start it.
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
Hi,
I want to read version number and company name from RC File at run time.
How can i do this ?
Thanks in advance
|
|
|
|
|
If you mean "read version information from the resources of a module at runtime",
then you can use GetFileVersionInfo (...). You can even use it on the calling
module by using GetModuleFilename to get the path to use.
There is even an article "ShowVer.exe command-line VERSIONINFO display program"[^]
with example code.
If you really mean from an .RC file, then just read it as text and parse
it.
|
|
|
|
|
another way is to load the resource section by calling findresource and loadresource.
Don't try it, just do it!
|
|
|
|
|
I am writing a software, it needs hide itself and capture a snapshot of the screen. It works well normally, but when system is busy, sometimes, the window of my program has not been hiden or the background has not been repainted but my program does not know that, the snapshot is taken even the screen is not updated yet.
I just use
ShowWindow(hwnd, SW_HIDE);
UpdateWindow(hwnd);
to hide my window. But I don't know when Windows will repaint the screen, how to wait until the background covered by my program is repainted by Windows?
|
|
|
|
|
Hi Daniel,
your problem is, that the paint-function from windows are message-oriented. The hiding of your window take a WM_PAINT message in the message-queue from all other windows which are behind your window. That is the problem, you don't know when all the other windows processes the WM_PAINT message.
My two solutions:
1) bad but simple, let "sleep" your application after ShowWindow() for some milliseconds, e.g. Sleep(100)
2) Write a global Keyboard-Hook (like other programs which takes a snapshot).
Regards
Frank
|
|
|
|
|
I'm looking for a way to save data in the Windows BMP format. The code should run on Unix platforms, too, so API functions are not applicable.
If a train station is where the train stops, what's a workstation...?
|
|
|
|
|
Bitmap format is pretty simple. You will need to define all structures (BITMAPFILEINFO, BITMAPINFO, etc.), then just fill them right and save to disk. Look up for more information on structures in MSDN[^]
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
|
|
|
|
|
Hi to all,
I need sources for programming external devices, actually I have to make a program to control electronic circuit boards... I collect some info from the net and I think it is easier to reach circuit boards with serial ports. Finally I guess there are some resources out there and if someone post these, I really will be gratefull to him/her...
Thanx in advance.
Not: I need these resources for our project (to add real physics to our robot project in school)...
|
|
|
|
|
There are a few Serial Communications classes around here (in codeproject) that help you have access to a serial port. You could search for them (I would give you the links but I don't remember where they are. I also need to go to bed, I am very tired). But, being an electrical engineer myself I have always programmed devices by dumping the binary the code into eeproms (assembly code), so serial communications were not always required. (I don't know your project specifications so I better stop here).
Good luck with your project!
Here are three links by the way (since you are a fellow engineer) :
http://www.codeproject.com/useritems/chaiyasit_t.asp?target=serial%7Ccommunication
http://www.codeproject.com/system/cserialcom.asp?target=serial%7Ccommunication
http://www.codeproject.com/system/serial_com.asp?target=serial%7Ccommunication
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
Read the manual of the device carefully. Maybe there is a API for the device. Also ensure that the device is installed properly and the OS is supported.
To tell a long story short: RTFM
PS: I have done this over and over with modems
Try this @ home. (B&B)
|
|
|
|
|
You know what? KarstenK is right.
But at the same time, to save you the trouble of learning windows programming (if you don't know any) and in case the device is designed by you or it doesn't have an API interface, just use plain MS-DOS and functions such as outp() to send data through a serial port.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
I am using VC6 - MFC
I designed a dialogbox in DialogEditor ...... and
I want this dialogbox will be my MDI child window of main MDI window!
So I mean, I want design interface (put controls to window: edit, button...) for all my MDI child window in Dialog Editor
, not by code (design by coding is slower than design by DialogEditor)
thank you!
|
|
|
|
|
When you are create an application using AppWizard, choose MFC AppWizard.
On page 1 of 6, choose "Multiple Documents" / MDI.
On page 6 of 6, choose CFormView as the base CView class.
Choose other options sensibly.
This will give you an MDI Formview application. Now just change the dialog
the form uses to match the one you've already made elsewhere.
Tada!
Iain.
|
|
|
|
|
I want to evaluate each option's value in a dropdown listbox,but I don't know how to use the function get_options of IHTMLSelectElement.
I try this:
IHTMLElementCollection *lpCol=NULL;
IHTMLSelectElement *lpList=NULL;
IDispatch *lpDisp = NULL;
//init lpList
lpList->get_options((IDispatch **)&lpCol); //this doesn't work!!!!!!!
and
lpList->get_options(&lpDisp);
lpDisp->QueryInterface(IID_IHTMLElementCollection,(void**)&lpCol); //doesn't work either.
please help me!!
Thanks in advance!
Alan Shen.
|
|
|
|