|
what about you compare the date only at DTN_CLOSEUP Notification if you already got DTN_DROPDOWN notification, that is you compare the date only when calender is closed if the calender is opened by the user.
|
|
|
|
|
Hi all,
I want to clean my registry like i want to delete all the items from my registry which are not in use but are occupying spcae. I want to do this through coding....
Can anybody give me any idea to how to do it????
Thanks in advance
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
ThatsMe. wrote: Can anybody give me any idea to how to do it????
By using the registry API. For example, RegDeleteKey() and RegDeleteValue() .
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I think you would better use a ready registry cleaner as TuneUp or RegCleaner.
The biggest problem is not how to delete the key, the problem is how to identify the keys that are not usefull anymore. Good Luck and don't forget to make backups of your registry before trying your code :P
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
In VC6.0, the header files are like:
#ifndef _HEADER_FILE_H_
#define _HEADER_FILE_H_
#pragma once // sometimes with this line
...
#endif
In VC9.0 it simplified to this:
#pragma once
Did the semantic of #pragma once changed?
|
|
|
|
|
I believe behaviour of "#pragma once" is not changed. I think that code is written to support older compiler also where "#pragma once" is not supported, unsupported pragma directive is ignored by the compiler. And i can find such coding in MFC headers even in VC8, may be it is reused code from earlier version; search files in MFC include directory for "#pragma once", i think you can still find such code in VC9 also.
|
|
|
|
|
as #pragma directives are compiler specific, they may not work with another compiler. Of course, if your only compiler is Visual C++, you don't really have to care about.
but if you wish to be portable, then you have to go with #ifndef stuff...
|
|
|
|
|
Hi,
Hope somebody can help me with this one.
I want to capture pressing "[" and "]" on OnKeyDown() event.
For controls like shift
if(VK_SHIFT)
For capturing letters, I use example pressing s.
if(nChar=="s")
but for other keys like "[", "]" and numerics
it's not applicable.
How can i capture other keys?
|
|
|
|
|
TooShy2Talk wrote: For capturing letters, I use example pressing s.
if(nChar=="s")
you mean if (nChar == 'S') but you should always use Virtual Key codes, because nChar is the virtual key code, capital letter is identified by the Shift/caps key status. you may refer the list of key codes [Virtual-Key Codes ^] to use in your code.
TooShy2Talk wrote: but for other keys like "[", "]" and numerics
for numbers you may use '0'(30) - '9'(39) or VK_NUMPAD(0 - 9) because number can be entered in two different keys num pad and other above characters.
"[" can still be identified by VK_OEM_4 by Virtual-Key Codes but depends on keyboard layout. so it is better to use [VkKeyScan(Ex)^] to convert character to virtual key code and compare,
SHORT iSqrBracketOpen = VkKeyScan(_T('['));
void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
if (nChar == iSqrBracketOpen)
{
MessageBox(_T("Open Square Bracket"));
}
...
}
or use [ToAscii(Ex)^] or ToUnicode(Ex) to convert virtual key code to character and compare.
|
|
|
|
|
Thanks for the reply.
It's a big help
|
|
|
|
|
Hello
I want to make a decoding operation using sample grabber or my custom filter due to a custom encoding algorithm.
If I build a graph like : file source->decoder->file writer , is this approriate for decoder application by means of time ?
Best Regards,
Akin Ocal
|
|
|
|
|
If you know how to write custom filter, the answer to your question is obvious to you.
if the decoder filter is correctly exposed the Media types of the pin, Intelligent Connect of directshow framework can be able to choose the downstream filter not only file writter, can be audio / or video renderer. There is a graphedit tool you can build graph visually and can test.
Akin Ocal wrote: If I build a graph like : file source->decoder->file writer , is this approriate for decoder application by means of time ?
if you want to decode and dump that to a file, it is ok.
|
|
|
|
|
Using Visual C++ 6.0 MFC
I would like to setup a program where the user can use a menu item to display either of two views (say one view displays a square and if the other view is selected a circle is displayed). In addition I would like certain mouse events to cause the view to switch between these same two views. Say a left mouse click causes the square view to be displayed and a right mouse click causes the circle view to be displayed.
What is the best way to set something like this up? I can try to fill in the details, just looking for the best way to set things up initially.
|
|
|
|
|
|
I have an exception handling problem that I don't understand. My thread function is throwing an unhandled exception which is being caught by my catch(...) handler but not completely handled. This causes my thread to be prematurely terminated so that my cleanup logic is not executed. How can I change my handler so as to completely handle the exception and execute my cleanup logic? My code is below.
UINT CVarFileEvent::MultiFileProcessThread( LPVOID lpParam )
{
CVarFileEvent* pEvent = (CVarFileEvent*)lpParam;
TRACE( "> > > > Entering CVarFileEvent::MultiFileProcessThread()\n" );
HRESULT hRes = ::CoInitialize(NULL);
try
{
vector<cstring> vecVarFiles = UtilK::findAllFiles( "*.var",
pDataMovement->getInboxPath(),
false );
TRACE( "> > > > > Beginning processing of %d VAR files\n",
(int)vecVarFiles.size() );
CDataMovement* pDataMovement = pEvent->getDataMovementParent();
CFlightDataHandler FlightDataHandler( pDataMovement->getLogWriter() );
for( vector<cstring>::iterator iterFile = vecVarFiles.begin();
iterFile != vecVarFiles.end() && m_bIsThreadRunning;
iterFile++ )
{
FlightDataHandler.importVARFile( *iterFile );
::DeleteFile( *iterFile );
pDataMovement->deleteFileEvent( *iterFile );
}
}
catch(...)
{
CString strMsg( "importVARFile() failed with unexpected exception" );
TRACE( "> > > > CVarFileEvent::MultiFileProcessThread() exception < %s >\n", strMsg );
CLogWriter* pLogWriter = pDataMovement->getLogWriter();
pLogWriter->writeEntry( "CVarFileEvent", CLogWriter::LE_OPERATION_FAILED, strMsg );
}
::CoUninitialize();
pDataMovement->setInboxProcessEndEvent();
m_bIsThreadRunning = false;
return 1;
}</cstring></cstring>
Thanks
|
|
|
|
|
All the code in the exception handler should be able to execute outside the scope of the try block. One glaringly obvious potential you have is the use of pDataMovement pointer which is initialized in the try block. So if the exception is thrown before then or if the pointer is null your catch block will just throw another exception.
Wait, looking again I see that pointer used before it is even declared so I don't know how you get that to compile at all.
led mike
|
|
|
|
|
I'm developing a win32 application in C++ using minGW and Notepad++ as my development environment. I'm at the point where I'd like to create an owner-drawn menu with icons for my app. I've scoured the many examples on the site but all of them are for MSVS/VC++, and use many of the MFC components brought in from precompiled headers such as stdafx.h and afxtempl.h.
I'm hoping an experienced coder can make a recommendation for me. Is there a way for me to "import" these headers and components into my minGW dev env? I do have a copy of Visual Studio 8 installed. Is there some sort of front-end IDE for minGW that can emulate this? (I've read inklings that DevC++ can do this while googling.) Or am I better off trying to rebuild the classes and structures entirely myself?
Thanks in advance for the advice.
~g
|
|
|
|
|
greghint wrote: I'm developing a win32 application in C++ using minGW and Notepad++ as my development environment. I'm at the point where I'd like to create an owner-drawn menu with icons for my app
you can easily create owner -draw menu in win32 no need of MFC. you need to modify the style of menu items to MF_OWNERDRAW, then handle WM_MEASUREITEM Notification and WM_DRAWITEM message. You can easily map MFC code (you have now) to Win32 code.
see this [ MingW The Old FAQ^] "Theoretically, if you own the MFC source code you could build MFC libraries for MinGW"
|
|
|
|
|
I've been using Microsoft's MSDN example[^] as a starting point for my menu. This has been a bit frustrating, since some of the code simply doesn't work: SetMenuItemInfo() fails in their example until you set the cbSize of the MENUITEMINFO structure, which is explained in a different MSDN article.
Rather than using the MYITEM structure they do, I have created a class for my menu objects. Since my menu is created dynamically, I don't populate the menu structure when receiving the WM_CREATE message as they do in the example, but I am backpacking a pointer to a class item onto the MENUITEMINFO structure when menu items are created, like so:
MenuItem * myItem = &item;
MENUITEMINFO mii;
mii.fMask = MIIM_FTYPE | MIIM_DATA;
mii.fType = MFT_OWNERDRAW;
mii.dwItemData = (ULONG_PTR) myItem;
mii.cbSize = sizeof(mii);
SetMenuItemInfo(menu, item.itemID, FALSE, &mii);
In my function to handle the WM_MEASUREITEM message, I can access all of the class data from the pointer contained in the itemData member of the LPMEASUREITEMSTRUCT:
MenuItem *myItem = (MenuItem *) lpmis->itemData;
HDC hdc = GetDC(hwnd);
HFONT hfntOld = (HFONT)SelectObject(hdc, myItem->itemFont);
Microsoft use this exact same strategy when handling the WM_DRAWITEM message: they access the application-specific info from the itemData member of LPDRAWITEMSTRUCT. My implementation is the exact same as the example:
MenuItem *myItem = (MenuItem *) lpdis->itemData;
...
ExtTextOut(lpdis->lpdis->hDC,
x,
y,
ETO_OPAQUE,
&lpdis->rcItem,
myItem->itemLabel,
myItem->itemLabelLen,
NULL)
Sadly this strategy doesn't seem to work: any attempt to access the class items results in a crash. Is there some other sort of initialization I need to do that is missing from the example to ensure the pointer is passed along to the LPDRAWITEMSTRUCT?
Thanks in advance for any help or suggestions.
~g
|
|
|
|
|
I'm using Visual C++ 6.0 MFC in SDI application
I have a dialog box that comes up when the mouse is clicked. I don't understand how to control where in the client window this dialog box is displayed. I tried using something called SetWindowPos() but I did not understand what the first paramenter of the function call should be. Here's the routine that gets called
void GetMyPopBoxInfo(CMPopUpBox dlgPopUpBox)
{
// this displays my pop up dialog box
// but how do I set the position where this box is displayed?
dlgPopUpBox.DoModal();
}
|
|
|
|
|
You can control the position from within CMPopUpBox::OnInitDialog() .
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Take a look to SetWindowPos () and code it where David Crow told you
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Hello World,
I have a simple class
class CData
{
public:
CData () {}
CData (CObj obj, unsigned short a) {m_obj = obj ; m_a = a ; }
private:
unsigned short m_a ;
CObj m_obj ;
};
and a list of this type of object
typedef CList < CData, CData& > CDataList ;
Something odd happens when
CObj Obj ;
unsigned short a = 10 ;
CDataList TheList ;
TheList.AddTail(CData(Obj, a)) ;
TheList has one more element, and the data in m_obj is perfect. However, the value in m_a is not correct! It gets a random value.
If I change the default constructor to
CData(unsigned short a = 5) { m_a = a ; }
and do the same thing TheList.AddTail(CData(Obj, a)) ; m_a equals 5 (that is, the default value in the default constructor) and not the value passed when constructing the object...
I've tried to reproduce this problem in a different project and I can't. I guess there is something wrong with one of the classes I've defined. Any idea??
|
|
|
|
|
Do you have a copy constructor and are you copying all the members inside of it as well?
1. I will develop myself to the maximum of my potential in all ways
2. I will look for the good in all people and make them feel worthwhile.
3. If I have nothing good to say about a person, I will say nothing.
4. I will always be as enthusiastic about the success of others as I am about my own.
5. I will always remain loyal to God, my country, family and my friends - Chuck Norris
Ernest Laurentin
|
|
|
|
|
piul wrote: However, the value in m_a is not correct! It gets a random value.
Where/how are you verifying this?
I tried your code, and the CData object in the list did indeed contain the value 10 for the m_a member variable.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|