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
S

sdancer75

@sdancer75
About
Posts
159
Topics
69
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Non-latin characters are shown correctly in Debug mode but not in Release
    S sdancer75

    Hi, Thanks for your reply. Indeed I am using a 3rd party library but they are all set to ANSI (no unicode at all). I fixed the problem by dynamically changing the Dialog Title. Regards,

    sdancer75

    C / C++ / MFC c++ debugging question announcement learning

  • Non-latin characters are shown correctly in Debug mode but not in Release
    S sdancer75

    Hi, I have used older projects with Greek characters in ANSI and code pages without problems. Indeed unicode will solve the problem, but this specific project is too big and I have to make too many changes to finally make it work fine. Anyway, I managed to fix the problem changing the title of the title dynamically inside the code. Take in mind that when I recall strings from the Resource String Table using CString.LoadString(ID) I get gibberish but when I am using CStringW.LoadString(ID) it works. My String Table is not Unicode but inside VS2008 I set it up as Greek code page.

    sdancer75

    C / C++ / MFC c++ debugging question announcement learning

  • Non-latin characters are shown correctly in Debug mode but not in Release
    S sdancer75

    Hi, Thank you for your interest... Its the 1st time I meet this kind of problem. My Visual Studio is pretty old v2008 and the project settings are similar. Both Debug and Release share the same *.rc file. They are both an MFC Static, not using ATL and Character Set are "not set". My nonlatin character set is Greek. I can see the Greek titles in my dialog boxes in the editor. The only problem here is the Release version of the app. Don't know where to look for a problem. Regards,

    sdancer75

    C / C++ / MFC c++ debugging question announcement learning

  • Non-latin characters are shown correctly in Debug mode but not in Release
    S sdancer75

    Hi, I am using an MFC dialog (ANSI no Unicode) created in the resource editor with a nonlatin character name in its title, as a Property page. While running the debug mode I can see the nonlatin title in release mode I get a gibberish characters. What seems to be wrong here?

    sdancer75

    C / C++ / MFC c++ debugging question announcement learning

  • PNG image shown is missing 1 pixel right and 1 pixel bottom
    S sdancer75

    Thanks for your answer. The CGdiPlusBitmapResource is part of an older codeproject.com article at Loading JPG & PNG resources using GDI+[^] Anyway, I found the root of the problem. I had to call DrawImage with the size of the image. Now all works just fine.

    graphics.DrawImage(*pPngChannel, 0, 0, 800, 50);

    sdancer75

    C / C++ / MFC graphics com help question learning

  • PNG image shown is missing 1 pixel right and 1 pixel bottom
    S sdancer75

    Using the code below (called from void CLoadPngDlg::OnPaint()) I am trying to view a PNG file that already included in the resource (IDB_FULLSCRINFOBAR_OPAQ_TEST). As you can see in the image attached the bottom red line and the rightmost column of pixels are not shown. https://i.imgur.com/Ug6gYjr.jpg Image Attached[^] What seems to be the problem here?

    BOOL CLoadPngDlg::ShowPngAt(CDC *dcWnd) {

    CGdiPlusBitmapResource		\*pPngChannel;
    UINT						nWidth,nHeight;
    CRect						rectClient;
    CBitmap						Bitmap, \*pOldBitmap;	
    CDC							bitmapDC;
    CDC							\*dialogDC;
    
    pPngChannel	= NULL;
    pPngChannel = new CGdiPlusBitmapResource;
    
    if (!pPngChannel->Load(IDB\_FULLSCRINFOBAR\_OPAQ\_TEST, \_T("PNG"))) {
    	delete pPngChannel;
    	return TRUE;
    }
    
    GetWindowRect(&rectClient);
    
    // Get size of bitmap.
    nWidth = pPngChannel->m\_pBitmap->GetWidth();
    nHeight = pPngChannel->m\_pBitmap->GetHeight();
    
    bitmapDC.CreateCompatibleDC( dcWnd ); 
    Bitmap.CreateCompatibleBitmap(dcWnd, nWidth, nHeight);
    pOldBitmap = bitmapDC.SelectObject(&Bitmap);	
    
    Gdiplus::Graphics graphics(bitmapDC.GetSafeHdc());										
    graphics.DrawImage(\*pPngChannel, 0, 0);
    
    dcWnd->BitBlt(0, 0, rectClient.Width(), rectClient.Height(), &bitmapDC,   0,  0,   SRCCOPY );
    
    bitmapDC.SelectObject( pOldBitmap );
    bitmapDC.DeleteDC();
    
    
    if (pPngChannel != NULL)
    	delete pPngChannel;
    
    
    return FALSE;
    

    }

    sdancer75

    C / C++ / MFC graphics com help question learning

  • Sending raw data to a chinese POS58 thermal printer
    S sdancer75

    Hi, I want to send raw esc/pos (epson compatible) text data (not graphics) to a cheap chinese POS58 thermal printer using either MFC or Console32 application. Is there any library or sample to start of ? Regards,

    sdancer75

    ATL / WTL / STL

  • ShellExexute to open the default browswer
    S sdancer75

    According to this microsoft's article [^], if I wanted to use ShellExecute to open the default browser instead of the Internet Explorer, I had to use

    LONG r = ShellExecute(NULL, "open", "http://www.microsoft.com", NULL, NULL, SW_SHOWNORMAL);

    Ok. In my case I want to open this url http://www.mywebsite.com/article/month/section. I am doing this :

    AfxParseURL((LPCTSTR)m_strWebURL, dwServiceType, strServerName, strObject,nPort);
    strServerName = _T("http://") + strServerName;
    ::ShellExecute(NULL,_T("open"),strServerName,strObject ,NULL,SW_SHOWMAXIMIZED);

    This piece of code crashes the Visual Studio 2008. The original code i used below is worked just fine but it uses Internet Explorer instead of the default browser.

    ::ShellExecute(NULL,_T("open"),_T("explorer"),m_strWebURL ,NULL,SW_SHOWMAXIMIZED);

    What seems to be the problem in microsoft's code ? Regards,

    sdancer75

    C / C++ / MFC csharp visual-studio com help question

  • Windows 7 UAC prevents my app to write log data
    S sdancer75

    Thank you for your help :-) Best Regards,

    sdancer75

    C / C++ / MFC question

  • Windows 7 UAC prevents my app to write log data
    S sdancer75

    Thank you Is that backward compatible with windows xp/vista ? I think that win Xp does not support AppData. Is that correct ? What to do in this case ? Check the os and take a path decision specifically for it ?

    sdancer75

    C / C++ / MFC question

  • Windows 7 UAC prevents my app to write log data
    S sdancer75

    Windows 7 UAC prevents my application to write log data in the installation folder. The original text log file exists from the very beggining, but its empty. When I start my app with the -L parameter to start logging, it does not write anything due the UAC control. If I rum my app with Admin Priviledges then it works. As you can understand I can not suggest my client to run the app with right click and "run as an Administrator". Is there any solution for that ? Best Regards,

    sdancer75

    C / C++ / MFC question

  • Using ShellExecute or CreateProcess caller lose its focus
    S sdancer75

    Finally I used MsgWaitForMultipleObjects with message process loop. I avoid to use EnableWindow() function at all. It seems to work fine under Win7. I will take a copy to my work tommorow to test it under XP for paint corruption.

    sdancer75

    C / C++ / MFC c++ com help tutorial announcement

  • Using ShellExecute or CreateProcess caller lose its focus
    S sdancer75

    Quote:

    You can disable your app window and/or show a modal dialog while the worker thread is active and re-enable when it finishes.

    You mean a dummy dialog just to block to main app ?

    Quote:

    What do you mean by floating windows? There is no additional window.

    I mean the two windows that will be active at the same time (main and child) and user will have the ability to work with the both of them.

    sdancer75

    C / C++ / MFC c++ com help tutorial announcement

  • Using ShellExecute or CreateProcess caller lose its focus
    S sdancer75

    One last thing. The EnableWindow(xxxx) do the mess in my situation. If I dont use this function I have to process the paint messages from the child window. In this case I think that

    WaitForMultipleObjects

    will do the job in the XP case. Do you agree with this guess ? .... or better i will give it a try right now.

    sdancer75

    C / C++ / MFC c++ com help tutorial announcement

  • Using ShellExecute or CreateProcess caller lose its focus
    S sdancer75

    The worker thread does not lock the main app as long as its active. I dont want this. I just want a modal like behaviour and not floating windows all around the desktop.

    sdancer75

    C / C++ / MFC c++ com help tutorial announcement

  • Using ShellExecute or CreateProcess caller lose its focus
    S sdancer75

    Seems to work with one exception. I get a flicker since it instantly lose its focus and then regain it back....

    sdancer75

    C / C++ / MFC c++ com help tutorial announcement

  • Using ShellExecute or CreateProcess caller lose its focus
    S sdancer75

    Thanks for your time. Do you suggest to use WaitForMultipleObjects instead ?

    sdancer75

    C / C++ / MFC c++ com help tutorial announcement

  • Using ShellExecute or CreateProcess caller lose its focus
    S sdancer75

    I will give it a try but as you may already see, I am using the bringWindowToTop without success. Thanx

    sdancer75

    C / C++ / MFC c++ com help tutorial announcement

  • Using ShellExecute or CreateProcess caller lose its focus
    S sdancer75

    Hi, No problem at all, I just gave all the code in the link. Anyway, I attach you the most important code from the sample app.

    void CMainFrame::OnRunExternalApp() {

    SHELLEXECUTEINFO	lpExecInfo;
    PROCESS\_INFORMATION processInfo;
    DWORD				dwExitCode;
    HANDLE				hProcess = 0;
    BOOL				bResult;
    LPTSTR				strCmd;
    
    
    
    
    
    strCmd = \_T("");
    
    //bResult = StartupApplicationWithShell (\_T("LiveUpdate.exe"), (LPTSTR)strCmd,  GetSafeHwnd(), &hProcess);
    bResult = StartupApplicationWithProcess (\_T("C:\\\\Windows\\\\notepad.exe"), (LPTSTR)strCmd,  &processInfo);
    
    EnableWindow(FALSE);
    
    
    
    if(bResult) { //(UINT)result > HINSTANCE\_ERROR)
    
    	//ShowWindow( SW\_HIDE );
    	//ShowWindow( SW\_SHOWNOACTIVATE );
    	
    
        //WaitForSingleObject( hProcess, INFINITE );
    	WaitForSingleObject(processInfo.hProcess, INFINITE);
    	//WaitForMultipleObjects(1, &processInfo.hThread, TRUE, INFINITE );
    
    
    
    	   
    	//if (!GetExitCodeProcess(hProcess, &dwExitCode)) {
    	//	   	AMLOGINFO(\_T("LiveUpdate is not terminated normally.")); 
    	//}
    	if (!GetExitCodeProcess(processInfo.hProcess, &dwExitCode)) {
    		   	//failed
    	}
    	CloseHandle( processInfo.hProcess );
        CloseHandle( processInfo.hThread );
    	//CloseHandle(hProcess);
    
    
    } else {
    	
    	// failed
    }
    
    BringWindowToTop();
    EnableWindow(TRUE);
    
    //UpdateWindow();
    
    //::SetWindowPos( GetSafeHwnd(), HWND\_TOP, 0, 0, 0, 0, SWP\_NOMOVE | SWP\_NOSIZE | SWP\_SHOWWINDOW );
    

    }

    sdancer75

    C / C++ / MFC c++ com help tutorial announcement

  • Using ShellExecute or CreateProcess caller lose its focus
    S sdancer75

    I posted a link in my 1st post with a sample MFC/SDI application that have all the code you need. http://www.filedropper.com/shellexecutecreateprocesstestapp[^]

    sdancer75

    C / C++ / MFC c++ com help tutorial 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