Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
D

dan o

@dan o
About
Posts
28
Topics
4
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to use GetTimeZoneInformation
    D dan o

    perhaps next code snippet helps you CStringArray m_pszFileNames void ::TestFile() { struct _finddata_t g_file; long hFile, lTime; CString strName, strPath, strCurrentPath; m_pszFileNames.RemoveAll(); strPath = "c:\testpath"; /* Get the current working directory: */ char buffer[_MAX_PATH]; _getcwd( buffer, _MAX_PATH ); strCurrentPath.Format( _T("%s"), buffer); _tchdir(strPath); if( (hFile = _findfirst( "*.*", &g_file )) == -1L ) { printf( "No files in current directory!\n" ); } else { strName = g_file.name; m_pszFileNames.Add(strName); /* Find the rest of the *.* files */ while( _findnext( hFile, &g_file ) == 0 ) { strName = g_file.name; m_pszFileNames.Add(strName); lTime = g_file.time_write; } _findclose( hFile ); } _tchdir(strCurrentPath); }

    C / C++ / MFC question json help tutorial

  • How to use GetTimeZoneInformation
    D dan o

    BOOL bFound = FALSE; for(i=0;i<=m_pszTimeZones.GetUpperBound();i++) { strTest = m_pszTimeZones.GetAt(i); strTemp = m_pszTimeZones.GetAt(i); stdTT = m_pszNames.GetAt(i); strTest = strTest.Mid(4,6); if ( strTest == strIn) { // Here find the correct zone name SetDetails(strTemp); SetDlgItemText(IDC_STD, stdTT); bFound = TRUE; break; } } if (!bFound) { AfxMessageBox("Error, No Found"); }

    C / C++ / MFC question json help tutorial

  • How to use GetTimeZoneInformation
    D dan o

    i wonder if you did exactly as below .h m_pszTimeZones m_pszTimeZonesNames .cpp void ::TestTZ() { HKEY hKey, Key; DWORD dwType = REG_SZ; int iRet = 0; CString strName, strValue, strPath, strKey; strPath = _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones"); iRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE, strPath, 0, KEY_READ, &hKey); if (iRet != ERROR_SUCCESS) return; TCHAR achKey[MAX_PATH]; TCHAR achClass[MAX_PATH] = _T(""); DWORD cchClassName = MAX_PATH; DWORD cSubKeys; DWORD cbMaxSubKey; DWORD cchMaxClass; DWORD cValues; DWORD cchMaxValue; DWORD cbMaxValueData; DWORD cbSecurityDescriptor; FILETIME ftLastWriteTime; DWORD i; DWORD retCode; TCHAR buffer[MAX_PATH]; DWORD dwSize = sizeof(buffer); // Get the class name and the value count. RegQueryInfoKey(hKey, // key handle achClass, // buffer for class name &cchClassName, // length of class string NULL, // reserved &cSubKeys, // number of subkeys &cbMaxSubKey, // longest subkey size &cchMaxClass, // longest class string &cValues, // number of values for this key &cchMaxValue, // longest value name &cbMaxValueData, // longest value data &cbSecurityDescriptor, // security descriptor &ftLastWriteTime); // last write time // Enumerate the child keys, until RegEnumKeyEx fails. Then // get the name of each child key and copy it into the list box. for (i = 0, retCode = ERROR_SUCCESS;retCode == ERROR_SUCCESS; i++) { ZeroMemory(&achKey, sizeof(achKey)); cbMaxSubKey = sizeof(achKey); retCode = RegEnumKeyEx(hKey, i, achKey, &cbMaxSubKey, NULL, NULL, NULL, &ftLastWriteTime); if (retCode == (DWORD)ERROR_SUCCESS) { strName.Format( _T("%s"), achKey); strKey = strPath + "\\" + strName; iRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE, strKey, 0, KEY_READ, &Key); if (iRet == ERROR_SUCCESS) { ZeroMemory(&buffer, sizeof(buffer)); dwSize = sizeof(buffer); //again iRet = RegQueryValueEx(Key, _T("Display"), NULL, &dwType, (BYTE *)buffer, &dwSize); if (iRet == ERROR_SUCCESS) { strValue.Format(_T("%s"), buffer); m_pszTimeZones.Add( strValue ); } if (iRet == ERROR_SUCCESS)

    C / C++ / MFC question json help tutorial

  • How to use GetTimeZoneInformation
    D dan o

    ok, anyway just closing this item now... just make a new stringarray CStringArray m_pszTimeZonesNames if (iRet == ERROR_SUCCESS) { ZeroMemory(&buffer, sizeof(buffer)); dwSize = sizeof(buffer); //again iRet = RegQueryValueEx(Key, _T("Std"), NULL, &dwType, (BYTE *)buffer, &dwSize); if (iRet == ERROR_SUCCESS) { strValue.Format(_T("%s"), buffer); m_pszTimeZonesNames.Add( strValue ); } have a nice day

    C / C++ / MFC question json help tutorial

  • Programming language index
    D dan o

    that (standard) C is more widely used than C++... yed, that is unfortunately true, a lot of embedded stuff kernel drivers are still c only and old appl which are still maintained use c

    The Lounge csharp c++ python perl css

  • How to use GetTimeZoneInformation
    D dan o

    yes... like where strInput = "-09:00" CString strTest; int i; for(i=0;i<=m_pszTimeZones.GetUpperBound();i++) { strTest = m_pszTimeZones.GetAt(i); strTest = strTest.Mid(4,6); if ( strTest == strInput) break; }

    C / C++ / MFC question json help tutorial

  • How to use GetTimeZoneInformation
    D dan o

    i will use something like this: i will store all zones into m_pszTimeZones and after that it is easy to get information you want .h CStringArray m_pszTimeZones; .cpp void ::TestTM { HKEY hKey, Key; DWORD dwType = REG_SZ; int iRet = 0; CString strName, strValue, strPath, strKey; strPath = _T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones"); iRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE, strPath, 0, KEY_READ, &hKey); if (iRet != ERROR_SUCCESS) return; TCHAR achKey[MAX_PATH]; TCHAR achClass[MAX_PATH] = _T(""); DWORD cchClassName = MAX_PATH; DWORD cSubKeys; DWORD cbMaxSubKey; DWORD cchMaxClass; DWORD cValues; DWORD cchMaxValue; DWORD cbMaxValueData; DWORD cbSecurityDescriptor; FILETIME ftLastWriteTime; DWORD i; DWORD retCode; TCHAR buffer[MAX_PATH]; DWORD dwSize = sizeof(buffer); // Get the class name and the value count. RegQueryInfoKey(hKey, // key handle achClass, // buffer for class name &cchClassName, // length of class string NULL, // reserved &cSubKeys, // number of subkeys &cbMaxSubKey, // longest subkey size &cchMaxClass, // longest class string &cValues, // number of values for this key &cchMaxValue, // longest value name &cbMaxValueData, // longest value data &cbSecurityDescriptor, // security descriptor &ftLastWriteTime); // last write time // Enumerate the child keys, until RegEnumKeyEx fails. Then // get the name of each child key and copy it into the list box. for (i = 0, retCode = ERROR_SUCCESS;retCode == ERROR_SUCCESS; i++) { ZeroMemory(&achKey, sizeof(achKey)); cbMaxSubKey = sizeof(achKey); retCode = RegEnumKeyEx(hKey, i, achKey, &cbMaxSubKey, NULL, NULL, NULL, &ftLastWriteTime); if (retCode == (DWORD)ERROR_SUCCESS) { strName.Format( _T("%s"), achKey); strKey = strPath + "\\" + strName; iRet = RegOpenKeyEx(HKEY_LOCAL_MACHINE, strKey, 0, KEY_READ, &Key); if (iRet == ERROR_SUCCESS) { ZeroMemory(&buffer, sizeof(buffer)); dwSize = sizeof(buffer); //again iRet = RegQueryValueEx(Key, _T("Display"), NULL, &dwType, (BYTE *)buffer, &dwSize);

    C / C++ / MFC question json help tutorial

  • How to use GetTimeZoneInformation
    D dan o

    you wrote: For some offsets it doesn't work which registry keys does it not work ?

    C / C++ / MFC question json help tutorial

  • Printing Class Library : Bottom Margin
    D dan o

    hi, i suppose that it should be changed into double CPage::SetBottomMargin(double w) { int temp=m_PrtDesc.rc.bottom; if(w > 0) m_PrtDesc.rc.bottom=ConvertToMappedUnits(w,VERTRES); if(w==-1) m_PrtDesc.rc.bottom=m_PrtDesc.n_maxLength; //m_PrtDesc.rc.right=m_PrtDesc.n_maxLength; //previous line return ConvertToInches(temp,VERTRES); } and calling pPage->SetBottomMargin(-1); :cool:

    C / C++ / MFC c++ php com help question

  • How to get chinese text from rtf .
    D dan o

    i think you are correct perhaps you could use CEdit instead but if not keep in mind RichEditCtrl in Visual C++ 7.0 supports Unicode. To obtain Unicode strings from the RichEditCtrl box, use EM_GETTEXTEX message instead of GetDlgItemText. SendMessage( EM_GETTEXTEX, (LPARAM) &getTextEx, // GETTEXTEX structure (WPARAM) lpszWChar // output WCHAR array ); see also: http://easai.00freehost.com/unicode.html[^]

    C / C++ / MFC help tutorial question

  • How to get chinese text from rtf .
    D dan o

    do you have compiled your project as unicode ? if not, make sure that you use preprocessor definitions ( c++ page ) _UNICODE output (link page) - entry point symbol wWinMainCRTStartup further on you could use _T("") instead "" in your code hope it helps

    C / C++ / MFC help tutorial question

  • Happy Chinese New Year
    D dan o

    谢谢! dan

    The Lounge com

  • dcPrint????
    D dan o

    hi, ON_COMMAND(ID_FILE_PRINT, OnFilePrint) printing goes like this void CMyDialog::OnFilePrint() { CString strValue; int iRet; CPrintInfo Info; //set your info flags PRINTDLG pdsetup; HDC hdc; //get your hdc from pdsetup CDC dc; //dcPrint??? //Attach hdc with dc //set drawing rect //call OnPreparePrinting(&Info); //call OnBeginPrinting(&dc, &Info); DOCINFO docInfo; // make your docinfo if needed //iRet = dc.StartDoc(&docInfo); //iRet = dc.StartPage(); //OnPrepareDC(&dc, &Info); myEditBox.GetWindowText(strValue); dc.TextOut( 200, 200, strValue); //place own coordinates //dc.EndPage(); //dc.EndDoc(); //OnEndPrinting(&dc, &Info); //dc.Detach(); hope it helps dan

    C / C++ / MFC tutorial question

  • access pci driver installation through C++
    D dan o

    i think you can use WMI for that.. see: msdn help on wmi for examples

    C / C++ / MFC c++ help question

  • atof conversion in unicode available??
    D dan o

    hi, CString strCurrent; strCurrent = _T("25.5"); //atof(strCurrent); double dValue = 0; _stscanf(strCurrent, TOFLOAT, &dValue); good luck... dan o

    C / C++ / MFC question

  • CMemDC help
    D dan o

    hi, why do you use CMemDC, and not directly dc ? HBRUSH oldbrush=(HBRUSH)dc->SelectObject(brush); HPEN oldpen=(HPEN)dc->SelectObject(pen); dc->Rectangle(&r);

    C / C++ / MFC csharp visual-studio graphics help tutorial

  • How to display the item of a treectrl like this?
    D dan o

    hi, create a imagelist .h CImageList m_cImageList; .cpp populate event() if (1) //bDoThisOnlyOnce m_cImageList.Create(IDB_TREEVIEW, 16, 10, RGB (255, 0, 255)); //IDB_TREEVIEW resource bitmap with a the all icons GetTreeCtrl().SetImageList(&m_cImageList, TVSIL_NORMAL); rootitem = GetTreeCtrl().InsertItem(TVIF_PARAM | TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE, _T("RootItem"), ILI_CLOSED_FOLDER, ILI_CLOSED_FOLDER, 0, 0, -1, TVI_ROOT, TVI_SORT ); //ILI_CLOSED_FOLDER, ILI_CLOSED_FOLDER <- item nr of imagelist Add msg .h afx_msg void OnItemexpanded(NMHDR* pNMHDR, LRESULT* pResult); .cpp void CMyTreeView::OnItemexpanding(NMHDR* pNMHDR, LRESULT* pResult) { NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR; HTREEITEM hItem = pNMTreeView->itemNew.hItem; CString string;string = GetPathFromItem (hItem); *pResult = FALSE; int inImage, inSelectedImage; if (pNMTreeView->action == TVE_EXPAND) { if (GetTreeCtrl().GetParentItem (hItem) == NULL ) { GetTreeCtrl().GetItemImage( hItem, inImage, inSelectedImage ); if (inImage == ILI_CLOSED_FOLDER && inSelectedImage == ILI_CLOSED_FOLDER) { GetTreeCtrl().SetItemImage( hItem, ILI_OPEN_FOLDER, ILI_OPEN_FOLDER); } } } else { // pNMTreeView->action == TVE_COLLAPSE if (GetTreeCtrl().GetParentItem (hItem) == NULL) { GetTreeCtrl().GetItemImage( hItem, inImage, inSelectedImage ); if (inImage == ILI_OPEN_FOLDER && inSelectedImage == ILI_OPEN_FOLDER) { GetTreeCtrl().SetItemImage( hItem, ILI_CLOSED_FOLDER, LI_CLOSED_FOLDER); } } } hope it helps dan o hope it helps

    C / C++ / MFC tutorial question

  • WMI - How do I use it ?
    D dan o

    hi, see at microsoft.com http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/example\_creating\_a\_wmi\_application.asp hope it helps dan o

    C / C++ / MFC c++ question tutorial

  • Closing Modal Dialog
    D dan o

    hi, of course is that possible just start a new tread in OnInitDialog() Or just with OnTimer Event of CDialog class and when time is reached/or thread is finished when dialog must close. just call OnOK() or ONCancel() dano

    C / C++ / MFC question

  • How to use Microsoft Layer for Unicode with MFC app
    D dan o

    hi, Win 9x does not support unicode itself, you must re-write the unicode functions yourself, and all functions/class export the normal char in stead w-char but Inside in your own class/functions w_char could be used.... i think it is very hard to make your program real unicode support for win'9x (perhaps you make a special resource file for translated texts, win'9x has a good support of russian/baltic/other east-european languagues it self, but Asian Languages like chinese / japanese / koreoan / sanskriet is very poor) dan o

    C / C++ / MFC c++ tutorial question announcement
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups