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

Drugodrf

@Drugodrf
About
Posts
15
Topics
6
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Exception handler
    D Drugodrf

    Greg Utas, thanks for article: i read it as soon as possible.

    DevParty: ok, all cases is too much, but most of the cases?
    I've tried both ways (exception C++ and SEH), but, for example, they catch division by zero, but not a string copy error.

    C / C++ / MFC hardware help question

  • Exception handler
    D Drugodrf

    I'm looking for a way to catch exceptions due to software or hardware errors and prevent my solution from breaking brutally, but I can't find anything complete. I have read the two main ways of handling exceptions, C ++ and SEH, but it seems to me that both do not include all cases that can happen. Can anyone help me ?

    C / C++ / MFC hardware help question

  • DLL for communication class
    D Drugodrf

    The interface are very simple, but are all C++ classes and i use MFC functions and classes. I take a look to all proposed solutions. Thanks to all very much.

    C / C++ / MFC c++ question csharp delphi

  • DLL for communication class
    D Drugodrf

    Hi to all, for my projects, sometimes i have to communicate with another computer, sometimes using serial port, sometimes using ethernet and so on: i had write some classes to use for this communication. Last time, on july of this year, my "communication partner" ask me to give him my class to be sure we use the some method, but i work with VC++ and MFC and he works with old visual basic; from this question, there is a way to make a DLL for each class i have, which is used by old visual basic, VC++ (with this, i think there is no problem), C# and Delphi (these are the most used languages in my neighborhood) ? I have to re-write all classes removing the MFC functions, or it's possible leave them so ? Thanks

    C / C++ / MFC c++ question csharp delphi

  • How to protect a member function
    D Drugodrf

    Thanks very much to all: it's works and it's what i need. For Albert Holguin and Aescleal: i think with "friends" it's more simple; thanks likewise.

    C / C++ / MFC tutorial question

  • How to protect a member function
    D Drugodrf

    As i can, i try. Thanks to all

    C / C++ / MFC tutorial question

  • How to protect a member function
    D Drugodrf

    Hi to all, i write a class (A) that works with an object from another class (B); class B needs to call a method from class A, but i would like this function from class A it's not visible when i use class A for my projects. Example: i write a numeric edit that use spin button; i write a spin button class derived from CSpinButtonCtrl and an edit class derived from a CEdit; edit have a function MyFunction() called from spin button class. So, when i use numeric edit in my projects, i would like MyFunction() (and also all class spin button) is not visible (protected). What is the correct way to do that, if it's possible ? Thanks

    C / C++ / MFC tutorial question

  • How to protect a function member
    D Drugodrf

    Hi to all, i write a class (A) that works with an object from another class (B); class B needs to call a method from class A, but i would like to this function from class A it's not visible when i use class A for my projects. Example: i write a numeric edit that use spin button; i write an spin button class derived from CSpinButtonCtrl and an edit class derived from a CEdit; edit have a function MyFunction() called from spin button class. So, when i use numeric edit in my projects, i would like to MyFunction() and also all class spin button are not visible (protected). What is the correct way to do that, if it's possible ? Thanks

    Managed C++/CLI tutorial question

  • Screensaver: keyboard and mouse hook and kill screensaver
    D Drugodrf

    Today i'm find the correct way to work; i don't know why, but i'm fixed on the way to count time for starts screen saver inside my application, so i need hooks; i try to use hooks (i need global hook) and it works, but i think it's better in another way: the correct way is leave the screen saver administration to the system and enable it or disable it when occurs; the correct way is: - Read if the screen saver is enabled from the system (so i know if i have to use it) - If disabled i do nothing - If enabled, disable it - Run all on my application - If device is sleeping for 1 minute, enable screen saver and reset counting - If device is current in use, disable screen saver and reset counting The rest it' better leave to the system: in this way i have only a delay of one minute for screen saver starting. Now it works fine; i'm sorry for these post. Thank you Drugo

    C / C++ / MFC com question lounge

  • Screensaver: keyboard and mouse hook and kill screensaver
    D Drugodrf

    I find a error in the thread code: i call stop to screen saver in the other thread, more slow, than the thread where check if is all in stop; so the first don't know that if is all stopped; now it works - i'm sorry. At the moment remains the problem regarding the hook: if i have the focus in my application, it works, but if i open the notepad and change focus, this hook don't works. Feel like the hook is "attacked" only on my application: It's due to the fact that the winthread object is called inside my application ? I have to change hook code ? Thank you Drugo

    C / C++ / MFC com question lounge

  • DocumentProperties() cause a First-chance exception
    D Drugodrf

    I try to change printer and now i don't have no more exception. Thank you so much for your answer. Bye Drugo

    C / C++ / MFC sales help tutorial announcement

  • DocumentProperties() cause a First-chance exception
    D Drugodrf

    ... and what do you think could to be due this message ? Thanks Drugo

    C / C++ / MFC sales help tutorial announcement

  • DocumentProperties() cause a First-chance exception
    D Drugodrf

    Whene the execution arrives in one of two lines i signed, compiler write: First-chance exception in MyApp.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception. First-chance exception in MyApp.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception. but the function works normally. Thanks Drugo

    C / C++ / MFC sales help tutorial announcement

  • Screensaver: keyboard and mouse hook and kill screensaver
    D Drugodrf

    In a application i writing, i want: - read if the user enabled system screen saver - read screen saver timeout - disable screen saver - the computer is connected to a external device: when this device is "sleeping", i starts to counts time and when it arrives to screen saver timeout, starts the screen saver. Until here i don't have problems: they start from here: - if the user move mouse or hit key, screen saver has to stop: is used this: http://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/3d9bb875-8e79-4c1e-b2ef-b24503e6abbd/how-to-create-a-keyboard-and-mouse-hook-in-visual-c-2005?forum=windowssdk[^] but it works only if the focus is on my application, don't works if focus it's on another window. - when the device "wake-up", the screen saver have to stop: i used this: http://msdn.microsoft.com/en-us/magazine/cc301462.aspx[[^](http://msdn.microsoft.com/en-us/magazine
    /cc301462.aspx "New Window")] but it's works only the first time: if the screen saver starts another time it don't works no more; i have to exit and starts again my application and then it works again only one time. Thanks Drugo

    C / C++ / MFC com question lounge

  • DocumentProperties() cause a First-chance exception
    D Drugodrf

    In an application i wrote years ago, i need to have a handle to printer propertiers device mode structure; i searched documents and i finded this function (DocumentProperties()); i searched example, i tried to use it, i writed code and the application works yet. Now i have to write similar application and i note when i call this function, it cause a first-chance exception (only when i call it to know the size of buffer); so i try with the old application and also that cause the exception; i try to solve it, but the the example i find and the documentation i have tell me that the use of the function i make it's correct; the funny fact is this method works very well in release mode and with the old application the customer don't have problems. The code is this:

    BOOL PrinterSettings(LPTSTR pszPrinterName, BOOL bSet)
    {
    if (_tcslen(pszPrinterName) <= 0)
    return FALSE;

    if (bSet && theApp.m\_hBarcodePrinterDev == NULL)
    	return FALSE;
    
    PRINTER\_DEFAULTS pd;
    DWORD			 dwNeeded;
    LONG			 lFlag;
    HANDLE			 hPrinter     = NULL;
    DEVMODE FAR\*	 pDevMode     = NULL;
    PRINTER\_INFO\_2\*	 pPrintInfo2  = NULL;
    BOOL			 bReturn      = TRUE;
    
    ZeroMemory(&pd, sizeof(pd));
    pd.DesiredAccess = PRINTER\_ALL\_ACCESS;
    
    bReturn = OpenPrinter(pszPrinterName, &hPrinter, &pd);
    
    if (bReturn)
    {
    	SetLastError(0);
    	bReturn = GetPrinter(hPrinter, 2, 0, 0, &dwNeeded);
    	
    	if (!bReturn && (GetLastError() == ERROR\_INSUFFICIENT\_BUFFER) && dwNeeded > 0)
    		bReturn = TRUE;
    }
    
    if (bReturn && (dwNeeded <= 0))
    	bReturn = FALSE;
    
    if (bReturn)
    	pPrintInfo2 = (PRINTER\_INFO\_2 \*) GlobalAlloc (GPTR, dwNeeded);
    
    if (bReturn && pPrintInfo2 == NULL)
    	bReturn = FALSE;
    
    if (bReturn)
    	bReturn = GetPrinter(hPrinter, 2, (LPBYTE) pPrintInfo2, dwNeeded, &dwNeeded);
    
    if (bReturn && pPrintInfo2->pDevMode == NULL)
    {
                // Here cause exception
    	dwNeeded = DocumentProperties(NULL, hPrinter, pszPrinterName, NULL, NULL, 0);
    
    	if (dwNeeded <= 0)
    		bReturn = FALSE;
    
    	if (bReturn)
    		pDevMode = (DEVMODE FAR\*) GlobalAlloc(GHND, dwNeeded);
    
    	if (bReturn && pDevMode == NULL)
    		bReturn = FALSE;
    
    	if (bReturn)
    	{
    		lFlag = DocumentProperties(NULL, hPrinter, pszPrinterName, pDevMode, NULL,DM\_OUT\_BUFFER);
    
    		if (lFlag != IDOK || pDevMode == NULL)
    			bReturn = FALSE;
    	}
    
    	if (bReturn)
    		pPrintInfo2->pDevMode = pDevMode;
    }
    
    if (
    
    C / C++ / MFC sales 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