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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
K

koumodaki

@koumodaki
About
Posts
73
Topics
34
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Displaying painted areas on Property Sheet
    K koumodaki

    I am using SDK so CPaintDC is ruled out. So I have to add BeginPaint() and EndPaint() instead fro it to work.

    C / C++ / MFC question architecture help

  • Displaying painted areas on Property Sheet
    K koumodaki

    Thanks. But I foound out what was missing from my code. I had to add PAINTSTRUCT ps; HDC hdc = ::BeginPaint(m_hWnd, &ps); at the start and ::EndPaint(m_hWnd, &ps); at end of my code snippet and it works. :)

    C / C++ / MFC question architecture help

  • Displaying painted areas on Property Sheet
    K koumodaki

    I have a property page with a static control area defined as CONTROL "",IDC_TEMP_GRPH,"Static",SS_GRAYFRAME,154,44,135,129 I am handling WM_PAINT message and the following piece of code gets executed: CDC* pDC = new CDC(GetDC(this->m_hWnd)); HWND hStatic = GetDlgItem(m_hWnd,IDC_TEMP_GRPH); RECT pirect; GetClientRect(hStatic,&pirect); COLORREF bkColor; bkColor = RGB(225,0,0); HBRUSH hBrush = ::CreateSolidBrush(bkColor); ::FillRect(GetDC(hStatic),&pirect,hBrush); The problem is I am not able to see this solid color block. It appears blinking while I drag the Property Sheet but disappears when I switch to next page and switch back to that page. Can anyone please tell me what is missing here?

    C / C++ / MFC question architecture help

  • Drawing on a Static control [modified]
    K koumodaki

    I am working on a Win32 based GUI, which has a menu with a static area defined as CONTROL "",IDC_GRAPH,"Static",SS_GRAYFRAME,17,119,264,54 in the rc file. In my OnPaint(), the following code gets executed HWND hStatic = GetDlgItem(m_hWnd,IDC_GRAPH); //m_hWnd is CWnd handle RECT pRect; HDC hStaticDC= GetDC(hStatic ); GetClientRect(hStatic,&pRect); iCX = (pRect->right - pRect->left)/2; iCY = (pRect->bottom - pRect->top)/2; COLORREF bkColor = GetBkColor(hStaticDC); HPEN pen = CreatePen(PS_SOLID,8,bkColor); MoveToEx(hStaticDC,iCX+4,iCY,NULL); LineTo(hStaticDC,iCX1+4,iCY); The code compiles correctly. But the bkColor gets CLR_INVALID and MoveToEx and LineTo returns a zero value. Where have I gone wrong?

    modified on Thursday, December 11, 2008 4:20 AM

    C / C++ / MFC dotnet graphics question

  • Setting Property Page edit box data
    K koumodaki

    Posting this again ..... please help ********************************************** I have created Property Sheet and Pages using Win32 SDK. Now I need to modify a edit box on a Page. The piece of code is HWND hPropSheet = GetActiveWindow(); HWND hPropPage0=PropSheet_GetCurrentPageHwnd(hPropSheet ); SetDlgItemText(hPropPage0,IDC_EDIT1,(LPCWSTR)szBuffer); Is this correct? I am not able to get the Handle to window to the Property Sheet ..... Please help

    C / C++ / MFC help question

  • Disabling Propery sheet close button
    K koumodaki

    Thanks :)

    C / C++ / MFC question

  • Disabling Propery sheet close button
    K koumodaki

    I have a Property Sheet and I need to disable the close button, the red "X" button that appears on the right top of the sheet. What is the procedure for disabling it?

    C / C++ / MFC question

  • Getting Property Sheet Handle
    K koumodaki

    Oops my bad. its HWND hPropPage0=PropSheet_GetCurrentPageHwnd(hPropSheet ); Sorry for the confusion. :doh:

    C / C++ / MFC help question

  • Getting Property Sheet Handle
    K koumodaki

    I have created Property Sheet and Pages using Win32 SDK. Now I need to modify a edit box on a Page. The piece of code is HWND hPropSheet = GetActiveWindow(); HWND hPropPage0=PropSheet_GetCurrentPageHwnd(hDlg); SetDlgItemText(hPropPage0,IDC_EDIT1,(LPCWSTR)szBuffer); Is this correct? I am not able to get the Handle to window to the Property Sheet ..... Please help :confused:

    C / C++ / MFC help question

  • Invalidate() == InvalidateRect()
    K koumodaki

    Can I use InvalidateRect() in place of CWnd::Invalidate().

    C / C++ / MFC

  • gethostname() function problems
    K koumodaki

    I am having trouble with gethostname(). The code compiles correctly but the function returns an unknown error. I have compiled on VC6 and .Net2005 platforms. While in VC6, the buffer remains empty, in .Net2005, it gives me unknown error. Why does this occur? char myname[256]; memset((void*)myname,0,sizeof(myname); if(!gethostname(myname, sizeof(myname))) { int _temp = WSAGetLastError(); if(_temp == WSAEFAULT) MessageBox(NULL,"Socket creation failed; Attempt to get host name failed; WSAEFAULT ","Lamia",MB_OK);/* who are we? */ if(_temp == WSANOTINITIALISED) MessageBox(NULL,"Socket creation failed; Attempt to get host name failed; WSANOTINITIALISED ","Lamia",MB_OK); if(_temp == WSAENETDOWN) MessageBox(NULL,"Socket creation failed; Attempt to get host name failed; WSAENETDOWN ","Lamia",MB_OK); if(_temp == WSAEINPROGRESS) MessageBox(NULL,"Socket creation failed; Attempt to get host name failed; WSAEINPROGRESS ","Lamia",MB_OK); else MessageBox(NULL,"Socket creation failed; Attempt to get host name failed; error unknown","Lamia",MB_OK); }

    C / C++ / MFC question csharp help

  • Reading from and Writing to a USB device using ReadFile() and WriteFile()
    K koumodaki

    I will have to look into the manual carefull now. Anyway thanks for the help. :)

    C / C++ / MFC hardware help

  • Reading from and Writing to a USB device using ReadFile() and WriteFile()
    K koumodaki

    I do have some manuals but they do not say much. This USB port is an auxillary port of the controller. Normally it is not used. But I do know the USB drivers. Could you please tell me the procedure to get the driver handle? Is there any article I can refer to?

    C / C++ / MFC hardware help

  • Reading from and Writing to a USB device using ReadFile() and WriteFile()
    K koumodaki

    Hi, I am working on a hardware controller device which has a USB port I need to use to write commands to the controller. I have been able to ennumerate the device and obtain the handle for that device using CreateFile(). But when I try to execute ReadFile() or WriteFile(), the function fails and GetLastError() returns ERROR_INVALID_FUNCTION. My code looks like this: HANDLE hUsbDevice = CreateFile(path.c_str(),GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); if (hUsbDevice == INVALID_HANDLE_VALUE) { val = GetLastError(); cout<<"failed in CreateFile"<<" error: "<<val<<"\n" ; } else { char _send_buff[] = {'I','n','i','t','1','=','0','\0'}; int _send_size = sizeof(_send_buff); int _wrstatus = 0; DWORD _bytes_written = 0; _wrstatus = WriteFile(hUsbDevice,_buff,_size,&_bytes_written,NULL); if (!_wrstatus) cout<<"\nError while writing port: "<<GetLastError()<<endl; } Where am I going wrong here :confused:

    C / C++ / MFC hardware help

  • running program across PCs
    K koumodaki

    I have written a program that enumetares a USB devices connected to a PC and obtains all the interface strings. I am using SetupDI APIs I compile the program on PC1 and everything works fine. When I copy the executable of my program [along with all files in release dir] to a different PC, say PC2 and execute it, the program does not return any USB interface strings. But when I compile my program on the PC2 and run it, I get all the USB interface strings Why does this happen? The configurations of both the PCs are same.

    C / C++ / MFC question announcement

  • Reading a USB device
    K koumodaki

    Thanks Judy. I will try this

    C / C++ / MFC help tutorial adobe json question

  • Reading a USB device
    K koumodaki

    I used the path but made a mistake while copying the code here. Ok so maybe I will try using WMI. Do you have any tutorial which explains how to use Windows API in such situatuons?

    C / C++ / MFC help tutorial adobe json question

  • Reading a USB device
    K koumodaki

    I tried the method you suggested. I did not work. The code snippet is std::string path = Devices[0] + "\\context.cfg"; HANDLE hUsbDevice = CreateFile(Devices[0].c_str(), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); if (hUsbDevice == INVALID_HANDLE_VALUE) return 1; char data[MAX_PATH]; DWORD nNumberOfBytesToRead = MAX_PATH; DWORD lpNumberOfBytesRead = 0; if(!ReadFile(hUsbDevice,(void*)data, nNumberOfBytesToRead, &lpNumberOfBytesRead,NULL)) { int err = GetLastError(); return 0; } GetLastError() returns ERROR_INVALID_PARAMETER

    C / C++ / MFC help tutorial adobe json question

  • Reading a USB device
    K koumodaki

    Havent tried that. Will check it out

    C / C++ / MFC help tutorial adobe json question

  • Reading a USB device
    K koumodaki

    I enumarate the USB device first and get the interface using SetupDiGetDeviceInterfaceDetail(). The name is stored in a vector Devices. Then I use the following call: HANDLE hUsbDevice = CreateFile(Devices[0].c_str(), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);

    C / C++ / MFC help tutorial adobe json question
  • Login

  • Don't have an account? Register

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