Hi, One solution is: CString sHexNumber = "ABC"; DWORD dwDecNumber = 0; sscanf( sHexNumber, _T("%16x"), &dwDecNumber ); Best regards Holger
HP
Posts
-
Q. Can I convert a CString value into a hex value? Urgent!!! -
Edit Box Problem!!Hi, I think the solution for both problems is to override the "OnOK" handler of the dialog:
void MyDialog::OnOK()
{
// suppose m_sPassword is bound with DDX to the editbox
UpdateData( TRUE );if( m\_sPassword != "PASSWORD" ) { AfxMessageBox( "Wrong Password" ); return; } CDialog::OnOK();
}
Best regards Holger
-
VB / VC++ questionHi, I think an easy way is to put the "C++" function into a DLL and export it from there. Then link the DLL to the VB program and import the function. Best Regards Holger
-
Get Binary TimeZone Info from RegistryHi, Why do not use the API function "GetTimeZoneInformation". I think it's much easier to handle. Best Regards Holger
-
Launch program when window starts?Hi, take a look to this CodeGuru article: http://codeguru.earthweb.com/misc/OnBoot.shtml Best regards Holger
-
How to format source code in discussion board messageHi all, can anybody tell me how i can format source code in discussion board messages? Thanks in advance Holger Persch
-
****** Please HELP! File & SQL ******Hi, try this:
CString BuildSQL( const CString& sStringFromFile )
{
CString sSQL, sTemp1, sTemp2;sSQL = \_T("CREATE TABLE "); // string at position 0 is the table name if( AfxExtractSubString( sTemp1, sStringFromFile, 0, ',' ) ) { sSQL += sTemp1; sSQL += "( "; // now add the column names and the column types for( int i = 1; ; i +=2 ) { if( AfxExtractSubString( sTemp1, sStringFromFile, i, ',' ) && AfxExtractSubString( sTemp2, sStringFromFile, i + 1, ',' ) ) { sSQL += sTemp1; sSQL += sTemp2; sSQL += \_T(", "); } else { break; } } // remove the last ", " sSQL.ReleaseBuffer( sSQL.GetLength() - 2 ); sSQL += \_T(" )"); } return sSQL;
}
Regards Holger Persch
-
Catching a KeystrokeI think it will be better to subclass an edit control and give it the custom formatting capabilities you want. You can handle the "WM_CHAR" message to control the edit's input. Then use the subclassed control instead of the regular edit control in your formview. Regards Holger Persch
-
Calling NT ServiceIf "to call" means to start a service, just use PJ Naughter's great "CNTService" classes (located in the "System -> Services" section) to get access to NT services. These classes will allow you to control (e.g. start, stop, install, uninstall,...) services in any way you want. Regards Holger Persch
-
Creating 2 documents instead of one.#1 First create two new data members in your application class. for example: CMultiDocTemplate* m_pDocTemplate1; CMultiDocTemplate* m_pDocTemplate2; #2 Change the document template registering to something like this. m_pDocTemplate1 = new CMultiDocTemplate( IDR_MYDOC1, RUNTIME_CLASS( CMyDocument1 ), RUNTIME_CLASS( CChildFrame ), RUNTIME_CLASS( CMyView1 ) ); AddDocTemplate( m_pDocTemplate1 ); m_pDocTemplate2 = new CMultiDocTemplate( IDR_MYDOC2, RUNTIME_CLASS( CMyDocument2 ), RUNTIME_CLASS( CChildFrame ), RUNTIME_CLASS( CMyView2 ) ); AddDocTemplate( m_pDocTemplate2 ); #3 Overwrite the "OnFileNew" command handler in your application class. void CMyApp::OnFileNew() { // don't call CWinApp::OnFileNew() // Create a new document from template 1 m_pDocTemplate1->OpenDocumentFile( NULL ); // Create a new document from template 2 m_pDocTemplate2->OpenDocumentFile( NULL ); } That's it. Best regards Holger Persch
-
Writing Windows NT ServiceAnother good workaround is Joerg Koenig's article "A Class For Building An NT Service " at CodeGuru. You can find it at: http://codeguru.earthweb.com/system/nt\_service.shtml Best regards Holger Persch
-
CTreeCtrl check stateA suggestion. Try to use the "ptDrag" member of the NM_TREEVIEW structure instead of GetCurrentMessage()->pt. There is no need to convert ptDrag to client coordinates, because it is already in client coords. If this doesn't work, using the OnLButtonDown handler instead of OnClick is a second chance. HTH Holger Persch
-
Writing Windows NT ServiceHi. Take a look at PJ Naughter's "CNTService" framework, that is located in the "System" section. It's a great advice in creating NT services. HTH Holger Persch
-
Print Preview, Zoom and font size?Hi, try using CFont::CreatePointFont(...) for initalising the font. HTH Holger Persch
-
sizeof(CString)Hi, a Suggestion for this behavior. The debugger will show you only 255 (or 256?) characters, even when CString contains more than this amount. HTH Holger Persch
-
a newbie-ish question about windows programmingHi! Put the following function into your dialog class and call it in the file i/o loop. This will ensure that the window messages are correctly disptached. void CYourDialog::PumpMessages() { static MSG msg; if( GetSafeHwnd() != NULL ) { while( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) ) { if( !IsDialogMessage( &msg ) ) { TranslateMessage( &msg ); DispatchMessage( &msg ); } } } } HTH Holger Persch
-
Handling the OK button in CPropertySheetHi, if you like i can send you a CPropertySheet derived class that exactly does what you asked for. Best regards Holger