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

Sergei

@Sergei
About
Posts
9
Topics
6
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • 3d rotation
    S Sergei

    this is rotation around Z (Plane figure) newx:=x*cos(angle) - y*sin(angle)); newy:=x*sin(angle) + y*cos(angle)); How to rotate the figure around x and y? So, how changes newx and newy in this case. I have x,y,z Coordinates, but i have only two coordinates (newx and newy) to paint the figure at the screen

    C / C++ / MFC tutorial question

  • an event from comm-port
    S Sergei

    Please, help me! I have external device, which connects with comm-port. I send to device the number, after it signaled it send to computer some signal; how can i receive this signal? in case, if device is nonsignaled, how can i wait it for five sec, and break the waiting operation? What do i need to write to this code, in the end of it? I know all abot WaitCommEvent and WaitForSingleObject, but i don't know how to use it. WaitForSingleObject doesn't work with EVENT, or i don't know how to use it:( HANDLE port; DWORD bc; DCB dcb; char buffer[100]; char *buf_out="50"; DWORD dwBlockSize=512; void *szBuffer; int send=255; ZeroMemory(&dcb,sizeof(DCB)); strcpy(buffer,"baud=1200 parity=N data=8 stop=1"); BuildCommDCB((char*)&buffer,&dcb); dcb.fRtsControl = RTS_CONTROL_ENABLE; port=CreateFile("COM1", GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); GetCommState(port,&dcb); SetCommState(port,&dcb); HeapFree(GetProcessHeap(),0,&dcb); szBuffer = malloc(dwBlockSize); memset(szBuffer, send, dwBlockSize); // Sending number for device WriteFile(port,szBuffer,sizeof(szBuffer),&bc,NULL); free(szBuffer); // Wait for signal for five sec CloseHandle(port);

    C / C++ / MFC question help tutorial

  • WaitForSingleObject
    S Sergei

    I have external device. The device is connected with the computer through the serial-port. I send on the device number (signal), if it answers, the necessary procedure is started. I can use WaitCommEvent() for event (signal, EV_DSR), but if devise doesn't answer, WaitCommEvent will wait indefinitely, but i need to wait about 5 sec. I used WaitForSingleObject, but it doesn't work! I don't know why. In what my error? HANDLE port; DWORD bc; DCB dcb; char buffer[100]; DWORD dwBlockSize=512; void *szBuffer; int numb=255; BOOL fSuccess; OVERLAPPED event; DWORD dwEvtMask; ZeroMemory(&dcb,sizeof(DCB)); strcpy(buffer,"baud=1200 parity=N data=8 stop=1"); BuildCommDCB((char*)&buffer,&dcb); dcb.fRtsControl = RTS_CONTROL_ENABLE; port=CreateFile("COM1", GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); GetCommState(port,&dcb); if(port==INVALID_HANDLE_VALUE) { CloseHandle(port); } SetCommState(port,&dcb); HeapFree(GetProcessHeap(),0,&dcb); szBuffer = malloc(dwBlockSize); memset(szBuffer, numb, dwBlockSize); WriteFile(port,szBuffer,sizeof(szBuffer),&bc,NULL); free(szBuffer); fSuccess = SetCommMask(port, EV_DSR); event.hEvent = CreateEvent(NULL,FALSE,FALSE,NULL); //Wait for signal if (WaitForSingleObject(event.hEvent, 5000) == WAIT_OBJECT_0) { //procedure } else AfxMessageBox("There is no signal from the device"); CloseHandle(port);

    C / C++ / MFC help question

  • control the video source (capture)
    S Sergei

    How to change parameters of video source: brightness, contrast and other? Not in the reference dialog box (capDlgVideoSource), by means of a movable indicator. For example, it's necessary automatically to customize all these parameters in program at startup (entering their numerical significances). Whether there are any functions, variable or something for a modification of these parameters?

    C / C++ / MFC tutorial question

  • WaitCommEvent
    S Sergei

    How can i wait an event only for 5 sec? I have DCB, HANDLE port; DWORD dwEvtMask; CreateFile(port,...); and after i have fSuccess = SetCommMask(port, EV_CTS|EV_DSR); event.hEvent = CreateEvent( NULL, FALSE, FALSE, NULL); if (WaitCommEvent(port, &dwEvtMask, &event)) { if (dwEvtMask & EV_DSR) { //Something to do } } So, i need to wait only for 5 sec, if i couldn't receive something to commport, how can i stop it? And how can i wait 5 sec?

    C / C++ / MFC question

  • RGB (for Christian)
    S Sergei

    Thanks

    C / C++ / MFC graphics tutorial question

  • RGB (for Christian)
    S Sergei

    What functions do i need to convert 8 or 16 bpp bitmap to a 24 bit DIBSection?

    C / C++ / MFC graphics tutorial question

  • Sending data in separate TCP packets using Visual C++
    S Sergei

    Hello, I use Visual C++ and I work with network sockets (MFC's CAsyncSocket and winapi socket functions). My application need some data to be sent in separate TCP packets. In other words I must be sure that some data are sending immediately and want to avoid a situation when this data will wait for the next data to join with them in a single packet. How can I achieve this? I tried to use both CAsyncSock::SetSockOpt() method and direct winapi's setsockopt() call to set TCP_NODELAY option, but they DON'T WORK, so I see in network packets analyzer. Any suggestions will be very appreciated. Thanks in advance.

    C / C++ / MFC c++ question sysadmin

  • API to play MP3 files
    S Sergei

    Take a look at Microsoft's Media Player ActiveX control. Plays MP3, WMA and a bunch of other stuff. Sergei

    C / C++ / MFC 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