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

staticv

@staticv
About
Posts
97
Topics
37
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Geek or Not?
    S staticv

    I was born after Monty Python finished airing? Whats the case for me? Am I not a geek?

    Top Web Hosting Providers[^] Premium Wordpress Themes by Moon Themes[^] Do, or do not. There is no 'try'.

    The Lounge css ios question

  • Microsoft and You
    S staticv

    WHAT? How did Microsoft got me work info?

    Top Web Hosting Providers[^] Premium Wordpress Themes by Moon Themes[^] Do, or do not. There is no 'try'.

    The Lounge lounge

  • I donated to wikipedia
    S staticv

    :laugh:

    Top Web Hosting Providers[^] Premium Wordpress Themes by Moon Themes[^] Do, or do not. There is no 'try'.

    The Lounge html css asp-net com sysadmin

  • ReportViewer VS 2008
    S staticv

    Hey, can anyone point me to tutorials about using the ReportViewer control in Visual Studio 2008? Also please only mention tutorials which are visual (have screenshots). Thanks

    Top Web Hosting Providers[^] Do, or do not. There is no 'try'.

    C# visual-studio csharp com hosting question

  • Get window handle on which mouse button was clicked
    S staticv

    WH_MOUSE Hook[^]

    Top Web Hosting Providers[^] Do, or do not. There is no 'try'.

    C / C++ / MFC question com hosting help

  • Get window handle on which mouse button was clicked
    S staticv

    Hmmm. But I ran into another problem. Since I only needed Desktop's ListView (SysListView32) mouse events. I used WH_MOUSE because it can be thread specific whereas WH_MOUSE_LL can be global hook only that's why. Now when I did this change, I'm not getting any events when I click on the desktop icons or anywhere in the desktop. hookMouse = SetWindowsHookEx(WH_MOUSE, (HOOKPROC)InternalMouseHookCallback, g_appInstance, threadID); Here g_appInstance is the address of the DLL. threadID is the ID of the thread in which there is the SysListView32 (which is the desktop). InternalMouseHookCallback is a callback of .NET function. But now its not working. Please help me out. I'm using the Global System Hooks in .NET

    Top Web Hosting Providers[^] Do, or do not. There is no 'try'.

    C / C++ / MFC question com hosting help

  • Get window handle on which mouse button was clicked
    S staticv

    Well, I was using WH_MOUSE_LL earlier. I changed my code to WH_MOUSE. Now the code is:

    HWND hWnd = NULL;
    HWND hDesktopListWnd = NULL;

    hWnd = FindWindow(_T("ProgMan"), NULL);
    hWnd = GetWindow(hWnd, GW_CHILD);
    hDesktopListWnd = GetWindow(hWnd, GW_CHILD);

    threadID = GetWindowThreadProcessId(hDesktopListWnd, NULL);

    hookMouse = SetWindowsHookEx(WH_MOUSE, (HOOKPROC)InternalMouseHookCallback, g_appInstance, threadID);

    It installs the hook successfully, but I don't get the mouse hook events now. Basically I want to get click events when any icon on the desktop is clicked.

    Top Web Hosting Providers[^] Do, or do not. There is no 'try'.

    C / C++ / MFC question com hosting help

  • Get window handle on which mouse button was clicked
    S staticv

    Hey, I'm using Windows Hook, I installed the mouse hook, system-wide and its working perfectly. Now there is a problem, I need to the get window handle on which the mouse was clicked.. How do I do that? Does the Mouse hook event passes us that information?

    Top Web Hosting Providers[^] Do, or do not. There is no 'try'.

    C / C++ / MFC question com hosting help

  • Anyone still use the Classic appearance? [modified]
    S staticv

    XP, classic theme, no visual effects, tuned for performance, black wallpaper (wallpaper :laugh: ). The reason? Damn slow PC I got :)

    Top Web Hosting Providers[^] Do, or do not. There is no 'try'.

    The Lounge hardware question announcement

  • C# Socket.BeginReceive/EndReceive
    S staticv

    Can you please provide example code, a tutorial, anything else? Thanks

    Top Web Hosting Providers[^] Do, or do not. There is no 'try'.

    C# question csharp

  • C# Socket.BeginReceive/EndReceive
    S staticv

    In what order is the Socket.BeginReceive/EndReceive functions called? For instance, I call BeginReceive twice, once to get the message length and the second time to get the message itself. Now the scenario is like that, for every message I send, I start waiting for its completion (actually acknowledgment of the message sent, also I wait for the action's completion after receiving the acknowledgment), so I call BeginReceive with each BeginSend, but in each BeginReceive's callback, I check if I'm receiving the length or the message. If I'm receiving the message and have received it completely, then I call another BeginReceive to receive the completion of the action. Now this is where things get out of sync. Because one of my receive callback is receiving bytes which it interprets as the length of them message when in fact it is the message itself. Now how do I resolve it? Here is the code, basically it is too big, sorry for that

    public void Send(string message)
    {
    try
    {
    bytesSent = 0;

                        writeDataBuffer = System.Text.Encoding.ASCII.GetBytes(message);
                        writeDataBuffer = WrapMessage(writeDataBuffer);
                        messageSendSize = writeDataBuffer.Length;
    
                        clientSocket.BeginSend(writeDataBuffer, bytesSent, messageSendSize, SocketFlags.None,
                                                                new AsyncCallback(SendComplete), clientSocket);
                }
                catch (SocketException socketException)
                {
                        MessageBox.Show(socketException.Message);
                }
        }
    
        public void WaitForData()
        {
                try
                {
                        if (! messageLengthReceived)
                        {
                                clientSocket.BeginReceive(receiveDataBuffer, bytesReceived, MESSAGE\_LENGTH\_SIZE - bytesReceived,
                                                                                SocketFlags.None, new AsyncCallback(RecieveComplete), clientSocket);
                        }
        public void Send(string message)
    

    {
    try
    {
    bytesSent = 0;

        writeDataBuffer = System.Text.Encoding.ASCII.GetBytes(message);
        writeDataBuffer = WrapMessage(writeDataBuffer);
        messageSendSize = writeDataBuffer.Length;
    
        clientSocket.BeginSend(writeDataBuffer, bytesSent, messageSendSize, Socket
    
    C# question csharp

  • TCP/IP Message Framing and Parsing [modified]
    S staticv

    Can you please provide an example? using the recv() and send() functions?

    Top Web Hosting Providers[^] Do, or do not. There is no 'try'.

    C / C++ / MFC question com sysadmin hosting json

  • TCP/IP Message Framing and Parsing [modified]
    S staticv

    I don't understand what you mean by no minimum? Can you please explain?

    Top Web Hosting Providers[^] Do, or do not. There is no 'try'.

    C / C++ / MFC question com sysadmin hosting json

  • TCP/IP Message Framing and Parsing [modified]
    S staticv

    I want to send varying length application specific messages between my client and server application. The problem is how should I determine the length of message when receiving it? I thought of one way was that I should append a termination string in the end of the message. But others said that prefixing the message length is far more better? May I know why and how do I prefix it? Any code examples would be really appreciated. I'm using Winsocks (version 2.2, if that helps) And, by the way, what is the minimum amount of bytes/bits that will successfully transfer in one shot using TCP/IP? Thanks

    Top Web Hosting Providers[^] Do, or do not. There is no 'try'.

    modified on Wednesday, August 26, 2009 6:25 AM

    C / C++ / MFC question com sysadmin hosting json

  • CAsyncSocket::Close Crashes
    S staticv

    I call the function which is called when the SERVICE_CONTROL_STOP event is fired by myself. But I'm unable to reproduce that crash. It only occurs when it is stopped by Service Manager. No I'm not using CAsyncSocket in multiple threads

    Top Web Hosting Providers[^] Do, or do not. There is no 'try'.

    C / C++ / MFC c++ debugging help sysadmin announcement

  • CAsyncSocket::Close Crashes
    S staticv

    Since, it is a Windows Service, and I'm using MSVC6, I'm really unable to debug it. When I call the Close method for CAsyncSocket class, the program crashes. So it seems that there is some problem in MFC's code.

    Top Web Hosting Providers[^] Do, or do not. There is no 'try'.

    C / C++ / MFC c++ debugging help sysadmin announcement

  • CAsyncSocket::Close Crashes
    S staticv

    Well, if it crashes then there is a problem :)

    Top Web Hosting Providers[^] Do, or do not. There is no 'try'.

    C / C++ / MFC c++ debugging help sysadmin announcement

  • CAsyncSocket::Close Crashes
    S staticv

    Hey, im doing some client/server stuff in a windows service. Pretty much new to this stuff using Visual C++ 6 The problem I'm encountering is that when I try to stop the service through Service Manager, it crashes. I added some MessageBoxes code, to trace where they are crashing and I found that when it closes the listener socket it crashes!!! I tried to run the service as a console application, and by myself called the function which is called SERVICE__CONTROL__STOP event is received so that I may reproduce the bug and debug easily. But it is working fine. The windows service is only crashing when I stop it through Service Manager Here is some code The main function

    int main(int argc, char* argv[])
    {
    // Create the service object
    CTestService CustomServiceObject;

    if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
    {
        std::cerr << "MFC failed to initialize!" << std::endl;
        return 1;
    }
    
    // Parse for standard arguments (install, uninstall, version etc.)
    if (! CustomServiceObject.ParseStandardArgs(argc, argv)) 
    {
        // StartService() calls ::StartServiceCtrlDispatcher() 
    // with the ServiceMain func and stuff
        CustomServiceObject.StartService();
    }
    
    // When we get here, the service has been stopped
    return CustomServiceObject.m\_Status.dwWin32ExitCode;
    

    }

    The Service Handler callback function

    // static member function (callback) to handle commands from the
    // service control manager
    void CNTService::Handler(DWORD dwOpcode)
    {
    // Get a pointer to the object
    CNTService* pService = m_pThis;

    pService->DebugMsg("CNTService::Handler(%lu)", dwOpcode);
    switch (dwOpcode) {
    case SERVICE\_CONTROL\_STOP: // 1
        pService->SetStatus(SERVICE\_STOP\_PENDING);
        pService->OnStop();
    
    // ..
    // .. 
    // other event handling
    // ..
    // ..
    

    }

    the OnStop() function

    void CTestService::OnStop()
    {
    m_sListener.ShutDown(2);
    m_sConnected.ShutDown(2);

    MessageBox(NULL, "After Shutdown", NULL, IDOK); 
    
    m\_sConnected.Close();
    
    MessageBox(NULL, "Closed connected socket", NULL, IDOK); 
    
    // crashes here when I try to stop through service manager
    // but if I run as console application works fine and terminates successfully
    m\_sListener.Close();
    
    MessageBox(NULL, "Closed listener socket", NULL, IDOK); 
    
    ::PostThreadMessa
    
    C / C++ / MFC c++ debugging help sysadmin announcement

  • Wait Until Event Occurs
    S staticv

    Okay, thanks I'll take a look at the source. Its not that I'm using only one socket :). I'll add support for more connections, but later. I only need blocking for listening and everything else asynchronous. I guess, I'll have to kick-off some threads. Any good strategy for using blocking listening and non-blocking I/O, MULTITHREADEDly :-D

    Top Web Hosting Providers[^] Do, or do not. There is no 'try'.

    C / C++ / MFC c++ com hosting tutorial question

  • Wait Until Event Occurs
    S staticv

    But, won't that block the thread and everything will stop!

    Top Web Hosting Providers[^] Do, or do not. There is no 'try'.

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