Quantcast
Channel: CodeGuru Forums - Visual C++ Programming
Viewing all 3016 articles
Browse latest View live

[RESOLVED] MFC ListControl InsertItem weird characters

$
0
0
Hello
What is wrong here ? :confused:
Code:

void CRDPDlg::OnBnClickedButton1()
{
        CFileDialog *cfileDlg = new CFileDialog(TRUE, NULL, NULL, OFN_ALLOWMULTISELECT, L"Text files (*.txt*)|*.txt*|");
        if (cfileDlg->DoModal() == IDOK){
                CString csPassFilePath(cfileDlg->GetPathName());
               
                int count = 0;
                std::string line;
                std::ifstream file(csPassFilePath);
                while (std::getline(file, line))
                {
                        listControl1.InsertItem(count,line.c_str());       
                        count++;
                }

        }
}

If i put listControl1.InsertItem(count,(LPCTSTR).c_str()); it prints weird characters
Thank you!

Code to measure CPU usage returns inconsistent results for overclocked CPU

$
0
0
I have a somewhat strange behavior of the code I'm showing below. This code is called repeatedly to measure the current CPU usage in my application (the value measured for all CPU cores):

Code:

int getCPUUsage(void)
{
    //RETURN: = CPU Usage in percent [0 - 100], or
    //        = -1 if error
    int nRes = -1;

    FILETIME ftIdle, ftKrnl, ftUsr;
    if(GetSystemTimes(&ftIdle, &ftKrnl, &ftUsr))
    {
        static BOOL bUsedOnce = FALSE;
        static ULONGLONG uOldIdle = 0;
        static ULONGLONG uOldKrnl = 0;
        static ULONGLONG uOldUsr = 0;

        ULONGLONG uIdle = ((ULONGLONG)ftIdle.dwHighDateTime << 32) | ftIdle.dwLowDateTime;
        ULONGLONG uKrnl = ((ULONGLONG)ftKrnl.dwHighDateTime << 32) | ftKrnl.dwLowDateTime;
        ULONGLONG uUsr = ((ULONGLONG)ftUsr.dwHighDateTime << 32) | ftUsr.dwLowDateTime;

        if(bUsedOnce)
        {
            ULONGLONG uDiffIdle = uIdle - uOldIdle;
            ULONGLONG uDiffKrnl = uKrnl - uOldKrnl;
            ULONGLONG uDiffUsr = uUsr - uOldUsr;

            if(uDiffKrnl + uDiffUsr)
            {
                //Calculate percentage
                nRes = (int)((uDiffKrnl + uDiffUsr - uDiffIdle) * 100 / (uDiffKrnl + uDiffUsr));
            }
        }

        bUsedOnce = TRUE;
        uOldIdle = uIdle;
        uOldKrnl = uKrnl;
        uOldUsr = uUsr;
    }

    return nRes;
}

I tested it on several of my PCs and the code seems to return reliable results. Unfortunately, on one machine with overclocked CPU the code above seems to produce results twenty percent lower than the reading from the Task Manager (namely, the task manager would be showing 100% CPU utilization and my code would consistently return only 80%.)

CPU specifics on that "overclocked" machine:

Quote:

Intel(R) Core(TM) i7
Cores: 4
Logical CPUs: 8
NUMA nodes: 1
Does anyone have any idea why this code could get such faulty reading?

PS. Note that that CPU doesn't seem to produce any strange behavior, besides giving this inconsistent reading.

C++ Semaphore, limit 2 instances at the same time

$
0
0
Hello
I'm trying to make a loop create 10 threads but only 2 working threads at the same time, wait until one finish the job then start another thread but never exceed 2 at same time. I'm doing this with semaphores.
Code:

#include <iostream>
#include <Windows.h>

typedef struct structure1 { int threadnr; } structure1;

HANDLE ghSemaphore = CreateSemaphore(NULL, 2, 2, NULL);

DWORD WINAPI ThreadProc(LPVOID param)
{
        structure1 * t1 = (structure1 *)param;
        printf("Thread %i\n",t1->threadnr);
        Sleep(1000);
        return 0;
}

int main()
{
        for (int i = 0; i < 10; i++)
        {
                WaitForSingleObject(ghSemaphore, INFINITE);
                structure1 * t1 = new structure1;
                t1->threadnr = i;
                CreateThread(NULL, 0, ThreadProc, t1, NULL, NULL);
                ReleaseSemaphore(ghSemaphore, 1, 0);
        }
        system("PAUSE");
        return 0;
}

I set the semaphore max value at 2 but it start all threads at same time instead of only 2.
I tried to set WaitForSingleObject at the beginning of ThreadProc and ReleaseSemaphore at the end and it works but it will create all threads in buffer. I want to create just 2 at same time and wait for one to finish then start another one
Any idea ?
Thank you

[RESOLVED] Wrong output with pointers

$
0
0
Hi everyone! I am trying to write a function that compares the original word with its reversed. My main problem, and I cannot figure out why, I am getting always a "false" return in a boolean function that compares the two words. I have checked for spaces or strange word composition but it seems all ok. Here is my code:

Code:

int len(const char* s)
{
    int n = 0;
    while (*s != '\0')
    {
        ++n;
        ++s;
    }
    return n;
}

char* reverse_word(const char* c)
{
    int n = len(c);
    //    char* p2 = new char[n + 1];
    //    char* temp = &p2[n];
    char* p2 = new char[n + 1](); // *** default initialize
    char* temp = &p2[n - 1]; // ***
   
    while(*c != '\0') *temp-- = *c++;
   
    delete[] p2;
   
    return p2;
}

bool is_palindrome(const char* c, const char* p)
{
    if (p == c) return true;
    return false;
}


int main(int argc, const char * argv[])
{
    char ar[] = {"kayak"};
    char* p = &ar[0];
    char* p1 = nullptr;
    p1 = reverse_word(p);
    cout << p << " and " << p1 << " are ";
    if (!is_palindrome(p,p1)) cout << "not ";
    cout << "palindromes." << endl;
    keep_window_open();
    return 0;
}

Thank you very much

MFC Window Minimize Issue

$
0
0
Hello,
I have an MFC application and I have an issue where it does not disappear when minimized to the system tray.
It does correctly show an icon in the system tray when minimized, but it shows up just above the task bar on the left side of the screen. It does not display an icon in the taskbar, and I do not want an icon in the task bar.
How do I get the application to completely disappear from the screen?
I have included the relevant source code.
Name:  EditMinimizedIssue8-16-15.jpg
Views: 104
Size:  8.4 KB

CODE:
Code:

// MyWinApp.cpp

#include "MyWinApp.h"
#include "MainFrame.h"

BOOL CMyWinApp::InitInstance()
{
  CMainFrame* pFrame = new CMainFrame;
  m_pMainWnd = pFrame;    // a CWinApp member variable

  pFrame->ShowWindow(SW_SHOW);
  pFrame->UpdateWindow(); // generates WM_PAINT msg

  return TRUE;
}

// MyWinApp.h
#include <afxwin.h>

class CMyWinApp : public CWinApp
{

public:
  virtual BOOL InitInstance();
};

// MainFrame.h

#include <afxwin.h>


class CMainFrame : public CFrameWnd
{
private:
        /**
        * MFC CONTROLS
        */

        CMenu m_TrayMenu;
        CEdit        edtStatusDisplay;

        /**
        * MFC OBJECTS
        */
        CWnd m_wndOwnder;



public:
        CMainFrame();  // Constructor
       
        BOOL SetTrayIcon(int intAction, int intIconId, LPCTSTR szTip);

        /**
        * INLINE
        */
        BOOL AddTrayIcon(int intIconID, LPCTSTR szTip)
        { return SetTrayIcon(NIM_ADD, intIconID, szTip);        }

        BOOL ModifyTrayIcon(int intIconID, LPCTSTR szTip)
        { return SetTrayIcon(NIM_MODIFY, intIconID, szTip);        }

        BOOL DeleteTrayIcon()
        { return SetTrayIcon(NIM_DELETE, 0, NULL);        }

       

       

        /**
        * END INLINE
        */


        DECLARE_MESSAGE_MAP();
       
        // window msg handling function
        afx_msg BOOL PreCreateWindow(CREATESTRUCT& cs);
        afx_msg void OnPaint();
        afx_msg void OnDestroy( );

        afx_msg void OnSysCommand(UINT nID, LPARAM lParam);

        afx_msg LRESULT OnTrayNotify(WPARAM wParam, LPARAM lParam);

        afx_msg void OnSysTrayMenuRestore(void);
        afx_msg void OnSysMenuExitApp(void);

};

// MainFrame.cpp
#include "MainFrame.h"
#include "resource.h"

#define IDC_EDT_DISPLAYSTATUS        150
#define NIF_ID 100
#define NIF_MSG (WM_USER+101)

#define DOODAD_PORTAL_STATUS_TIMER 1

BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
  // message            calls this function
        ON_WM_PAINT()

        ON_WM_SYSCOMMAND()
        ON_MESSAGE(NIF_MSG, OnTrayNotify)

        ON_WM_TIMER()

END_MESSAGE_MAP()

CMainFrame::CMainFrame() : TIMER_STATUS_DURATION(3500) // Constructor
{
       

        this->m_TrayMenu.LoadMenu(IDR_MENU_SYSTRAY);

        /**
        * ALWAYS CREATE WINDOW FIRST BEFORE
        * TRYING TO GET A DEVICE CONTEXT
        */

        this->Create(NULL, _T("Doodad 3.0 Powered by MFC"),
        WS_MINIMIZEBOX | WS_SYSMENU,
        CRect(10,10,830,515), NULL,
                MAKEINTRESOURCE(IDR_MENU_APPMAIN));

        CenterWindow(); // try this

       

        this->edtStatusDisplay.CreateEx(WS_EX_CLIENTEDGE, _T("EDIT"), _T(" "), WS_CHILD | WS_VISIBLE | WS_BORDER | ES_MULTILINE | ES_AUTOVSCROLL,
                                                                        CRect(451, 44, 795, 380), this, IDC_EDT_DISPLAYSTATUS);

       

}

void CMainFrame::OnPaint()
{

}


void CMainFrame::OnDestroy()
{

}



BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
        if (!CFrameWnd::PreCreateWindow(cs))
        return FALSE;

    // Create invisible window
    if (!::IsWindow(m_wndOwnder.m_hWnd))
    {
        LPCTSTR pstrOwnerClass = AfxRegisterWndClass(0);
        if (!m_wndOwnder.CreateEx(0, pstrOwnerClass, _T(""), WS_POPUP,
                CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
                NULL, 0))
            return FALSE;
    }

    cs.hwndParent = m_wndOwnder.m_hWnd;

    return TRUE;
}

LRESULT CMainFrame::OnTrayNotify(WPARAM wParam, LPARAM lParam)
{
        UINT uMsg = (UINT) lParam;

        switch(uMsg)
        {
        case WM_LBUTTONDBLCLK:
                this->DeleteTrayIcon();
                this->ShowWindow(SW_RESTORE);
                break;
    case WM_RBUTTONUP:
                CPoint pt;   
                GetCursorPos(&pt);
                m_TrayMenu.GetSubMenu(0)->TrackPopupMenu(TPM_RIGHTALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON,pt.x,pt.y,this);
                break;
        };

        return TRUE;
}

void CMainFrame::OnSysTrayMenuRestore(void)
{
        this->DeleteTrayIcon();
        this->ShowWindow(SW_RESTORE);
}


void CMainFrame::OnSysMenuExitApp(void)
{
        this->DeleteTrayIcon();
        this->DestroyWindow();
}

BOOL CMainFrame::SetTrayIcon(int intAction, int intIconId, LPCTSTR szTip)
{
        NOTIFYICONDATA nid;

        memset(&nid, 0, sizeof(nid));
        nid.cbSize = sizeof(nid);
        nid.hWnd = this->m_hWnd;
        nid.uID = NIF_ID;
        if(intAction != NIM_DELETE)
        {
                nid.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
                nid.uCallbackMessage = NIF_MSG;
                nid.hIcon = ::LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(intIconId));
                Checked::tcscpy_s(nid.szTip, sizeof(nid.szTip)/sizeof(TCHAR), szTip);
        }

        return Shell_NotifyIcon(intAction, &nid);
}

void CMainFrame::OnSysCommand(UINT nID, LPARAM lParam)
{
        switch(nID)
        {
        case SC_MINIMIZE:
                this->AddTrayIcon(IDI_MYAPP_OK, this->m_pMyApp->GetStatusMessageAsCStr());
                AfxGetMainWnd()->ShowWindow(SW_HIDE);
                break;
        case SC_MAXIMIZE:
                break;
        case SC_RESTORE:
                break;
        default:
                break;
        }

        CFrameWnd::OnSysCommand(nID, lParam);
}



/**
* PROTECTED METHODS
*/

Attached Images
 

Multithreading

$
0
0
Hi everyone,

I would like to learn how to Multithread in C++, however, I don't really know where to start.
As I understand it, Boost is the easiest to use to accomplish this?
Or should I be looking at something else?
Also, can anyone link me to a tutorial to get started?

Thank you in advance.

64 bits application using Visual Basic 6 AciveX controls

$
0
0
Hello

I have an application made with VC++ that can show a lot of dialogs. Those dialogs have been defined in an RC file and contains ActiveX controls made with Visual Basic 6.
My promen is the following one:
I have compiled the application in 64 bits, and when I launch the application and it is going to show a dialog, it fails. I think this is due to there is not 64 bits runtime for VB6.
What I want it is to generate an equivalent RC file to the RC file I have but replacing the controls made with VB6 with others made with VC++.
The obvious way is to edit the dialogs with Visual Studio C++ resource editor, and replace each control with its equivalent control. The problem is that I have a lot of dialogs (about 1000).
Is there a easy way to do this?

A possible way could be to generate an application that load the dialogs, and replace the controls during the execution, and then generate and RC file with the resultant dialogs. Something similar to what makes Visual Studio C++ resource editor.
I have tried to implement this solution, but I don't find the way to generate an RC file from a dialog loaded during the application execution.

Any help will be appreciated,
Best regards.

Converting 32-bit into 64

$
0
0
I have a sample code.

Code:

static DWORD CALLBACK StreamInCallback(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
        {
        DWORD dwRead(0);

                if(SUCCEEDED(g_pTextFile->Read(pbBuff, cb, dwRead)))
                {
            *pcb = LONG(dwRead);

                        return 0;
                }

                return 1;
        }

It works fine in 32-bit environment. But when I convert the whole project into 64-bit, I come across this error.

Quote:

Error 1 error C2440: '=' : cannot convert from 'DWORD (__cdecl *)(DWORD,LPBYTE,LONG,LONG *)' to 'EDITSTREAMCALLBACK' c:\maverick\projects\ccpm\src\main_ccpm_11.0.0.7\LicenseBox.h 70
Error 2 error C2440: '=' : cannot convert from 'DWORD (__cdecl *)(DWORD,LPBYTE,LONG,LONG *)' to 'EDITSTREAMCALLBACK' c:\maverick\projects\ccpm\src\main_ccpm_11.0.0.7\LicenseBox.h 70
Error 3 error C2440: '=' : cannot convert from 'DWORD (__cdecl *)(DWORD,LPBYTE,LONG,LONG *)' to 'EDITSTREAMCALLBACK' c:\maverick\projects\ccpm\src\main_ccpm_11.0.0.7\LicenseBox.h 70
Error 4 error C2440: '=' : cannot convert from 'DWORD (__cdecl *)(DWORD,LPBYTE,LONG,LONG *)' to 'EDITSTREAMCALLBACK' c:\maverick\projects\ccpm\src\main_ccpm_11.0.0.7\LicenseBox.h 70
Error 5 error C2440: '=' : cannot convert from 'DWORD (__cdecl *)(DWORD,LPBYTE,LONG,LONG *)' to 'EDITSTREAMCALLBACK' c:\maverick\projects\ccpm\src\main_ccpm_11.0.0.7\LicenseBox.h 70
Error 6 error C2440: '=' : cannot convert from 'DWORD (__cdecl *)(DWORD,LPBYTE,LONG,LONG *)' to 'EDITSTREAMCALLBACK' c:\maverick\projects\ccpm\src\main_ccpm_11.0.0.7\LicenseBox.h 70
Error 44 error C2440: '=' : cannot convert from 'DWORD (__cdecl *)(DWORD,LPBYTE,LONG,LONG *)' to 'EDITSTREAMCALLBACK' c:\maverick\projects\ccpm\src\main_ccpm_11.0.0.7\LicenseBox.h 70
While using this function

Code:

EDITSTREAM es;
ZeroMemory(&es, sizeof(EDITSTREAM));
es.pfnCallback = StreamInCallback;

Can someone suggest me change in this code so that I can resolve this error in 64-bit?

Programming certification

$
0
0
Hi to all,

Nowadays every skill has a certification, like MCITP, CCNA and so on. What about the programming? For example, apart from the universal degrees, is there any certification on C++ programming language? Someone that wants to be employed in a e.g., company, will need it so much to prove his ability, I think.

Why is this GUID decorated?

$
0
0
Code:

DEFINE_GUID(TID_ActualCost_Data,
        0xA51D06AC, 0x86B7, 0x4998, 0xB0, 0xAA, 0xE1, 0x5F, 0x3E, 0x15, 0x22, 0xB7);

Code:

Error        6        error LNK2001: unresolved external symbol _TID_ActualCost_Data        E:\Jacky\Desktop\Advanced Animation With DirectX\Chap03\ParseFrame\Direct3D.obj        ParseFrame
I don't know why it is not linkable. Could be other places. But Is this the one that causes the error?
Thanks
Jack

Active Directory - What is the meaning of "protecting with RMS"?

$
0
0
Hello,

I want to use the AD RMS SDK but I don't understand what happens there with the files and what it means to protect the files with RMS.
Can someone answer me in a simple english, please?

1. What is the meaning of "protecting with RMS", besides getting the rights like (read, write, export, print ...) from the templates and serving this to the clients?

2. What happens with the files?

VC++6.0, Unicode, and ANSI strings

$
0
0
I have a VC++ 6.0 project that I'm thinking about rebuilding in Unicode. The bigget problem is that the data that I have to processes is 8-bit binary data that sometimes contains strings (e.g. "-12345X") that I have to detect.

I would like to have a class, something like an equivalent CStringA, that I can use on the 8-bit data when compiled with UNICODE/_UNICODE defined. I don't want to reinvent the wheel if someone has already done the heavy lifting. If not then I was thinking of wrapping the string function (i.e. strcat(), strcmp(), strcpy(), etc.) in a class.

Actually, I'm not sure it is worth the effort to rebuild in Unicode.

Anybody know of something I can beg, borrow, or steal?

Hook SendMessage for background processes

$
0
0
Hello
I successfully tested SetWindowsHookEx WH_CALLWNDPROC to hook any WM_SETTEXT in the system, it works perfect but WM_SETTEXT doesn't capture messages that are sent through processes in background, for example a program tries to write in a file and i want to capture that text. What kind of WM_WHAT should i use ? I tried WM_GETTEXT, SETTEXT they capture the text but not the text that goes through processes. Any though\idea ? Thank you very much!

Need opinion about proposal to set up a e-platform

$
0
0
Hi gurus,

how is it going? A friend and I are currently in the process of founding an enterprise in the e-commerce area. Therefore we need a creative and innovative webpage, that functions fast and looks unique.
We have asked a group of programmers and designers (they are called DMT from Peru, as we will operate in Peru as well) for an offer to design and develope this platform.
As my buddy and I lack IT knowledge we would like to ask professionals about their opinion considering their proposal as some features incl the time that would be necessary seem somehow sceptical.

The entire set-up/programming of the platform (front- & back-end) would take 52 days (8h per day we calculated)
+
design(25days) & mockups(20days) as step before.

The webstore, to give you a general impression how the page could finally appear, would be a mix of features of pinterest and jochen-schweizer.de considering the front- & backend.

We just want to give some examples of the feature list DMT proposed considering the platform caracteristics we prefer.

-page: feature (hours h necessary)

-registration page: send e-mail after registration process (8h backend)
-registration page: registration via facebook (12h backend 4h frontend)
-login page: field validation (4h backend 6h frontend)
-homepage: search function (6h backend 6h frontend)
-business profile: product list (10h backend 12h frontend)
-product profile: product information (6h backend 8h frontend)
-shopping cart page: payment selection (4h backend 2h frontend)
-...

There are many more features, but this should give you a general insight of what they are offering.

Considering all this information we hope, that there are some gurus that could give us their valuable opinion about the DMT offering. If it is realistic with regard to the features, example pages and hours you just have seen or if not.


We are looking forward hearing from you and appreciate every signle opinion.

Thank you and have a great day.

buddE

WiFi Serial Module

$
0
0
Hi,

I am using RS232/RS485 serial to USB converters in my project for serial communication. Just i connect and use these converters. working good.

I like to use WiFi serial converters. Its very costly.

So, I like to go with <b>wireless (WiFi / Bluetooth) serial module</b>, be'cos cost is affordable.

But this WiFi Module Support AT+ Instruction Set for Configuration.

I have an doubt, after configure the WiFi module using AT+ Instruction Set, Its ready to response for visual c++ serial coding or these WiFi modules response only AT+ Instruction Set .

I don't know, how to communicate this module via visual c++ serial communication coding.

Pls help me.

Virtual File Recovery

$
0
0
Virtual File Recovery Process Execution: Data from VHD folder or files that are damaged, deleted, shift deleted, formatted partition (both NTFS and FAT) will be retrieved and gives the best Virtual file recovery process execution.

Read more :- http://www.undeletepcfiles.com/vhd-d...very-tool.html

[RESOLVED] MFC ListControl InsertItem weird characters

$
0
0
Hello
What is wrong here ? :confused:
Code:

void CRDPDlg::OnBnClickedButton1()
{
        CFileDialog *cfileDlg = new CFileDialog(TRUE, NULL, NULL, OFN_ALLOWMULTISELECT, L"Text files (*.txt*)|*.txt*|");
        if (cfileDlg->DoModal() == IDOK){
                CString csPassFilePath(cfileDlg->GetPathName());
               
                int count = 0;
                std::string line;
                std::ifstream file(csPassFilePath);
                while (std::getline(file, line))
                {
                        listControl1.InsertItem(count,line.c_str());       
                        count++;
                }

        }
}

If i put listControl1.InsertItem(count,(LPCTSTR).c_str()); it prints weird characters
Thank you!

my script

$
0
0
i'm writing a script i'm working about this code
#include <windows.h>
#include "resources.h"

ID_MENU_MAIN MENU
BEGIN
POPUP "&File"
BEGIN
MENUITEM "&New...", CMD_FILE_NEW
MENUITEM "&Open...", CMD_FILE_OPEN
MENUITEM SEPARATOR
MENUITEM "E&xit", CMD_FILE_EXIT
END
END

And here is the corresponding resources.h file:
#define ID_MENU_MAIN 100

#define CMD_FILE_NEW 1001
#define CMD_FILE_OPEN 1002
#define CMD_FILE_EXIT 1003
anyway ...... nice to work about this!

Segmentation fault in C++ program

$
0
0
Hi,

I have a program in C/C++ that runs perfectly in my Windows 7, 32 bits.

But when I compile it in Linux, I get - only for some files reading - the "segmentation fault" error.

Below is the report of strace. Note: the overflow error of the file de431.eph does not happen with others smaller files. I don't know what might be causing this. The file is corrupted? Or is it too large?...

Code:

-bash-4.1$ strace ./swetest -p2 -j5000000 -ejplde431.eph
execve("./swetest", ["./swetest", "-p2", "-j5000000", "-ejplde431.eph"], [/* 28 vars */]) = 0
brk(0)                                  = 0x9d90000
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7705000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=31601, ...}) = 0
mmap2(NULL, 31601, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb76fd000
close(3)                                = 0
open("/lib/libm.so.6", O_RDONLY)        = 3
read(3, "\177ELF\1\1\1\3\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0p4\0\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=200024, ...}) = 0
mmap2(NULL, 168064, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb76d3000
mmap2(0xb76fb000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x27000) = 0xb76fb000
close(3)                                = 0
open("/lib/libc.so.6", O_RDONLY)        = 3
read(3, "\177ELF\1\1\1\3\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\220n\1\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1902916, ...}) = 0
mmap2(NULL, 1665452, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0xb753c000
mmap2(0xb76cd000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x190000) = 0xb76cd000
mmap2(0xb76d0000, 10668, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb76d0000
close(3)                                = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb753b000
set_thread_area({entry_number:-1 -> 12, base_addr:0xb753b6c0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
mprotect(0xb76cd000, 8192, PROT_READ)  = 0
mprotect(0xb76fb000, 4096, PROT_READ)  = 0
mprotect(0xb7725000, 4096, PROT_READ)  = 0
munmap(0xb76fd000, 31601)              = 0
access("/etc/sysconfig/32bit_ssse3_memcpy_via_32bit_ssse3_memmove", F_OK) = -1 ENOENT (No such file or directory)
uname({sys="Linux", node="vps.casadohosting.com", ...}) = 0
fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7704000
brk(0)                                  = 0x9d90000
brk(0x9db1000)                          = 0x9db1000
open("sepl_18.se1", O_RDONLY)          = -1 ENOENT (No such file or directory)
open("sepl_18.se1", O_RDONLY)          = -1 ENOENT (No such file or directory)
open("./sepl_18.se1", O_RDONLY)        = -1 ENOENT (No such file or directory)
open("de431.eph", O_RDONLY)            = -1 EOVERFLOW (Value too large for defined data type)
open("de431.eph", O_RDONLY)            = -1 EOVERFLOW (Value too large for defined data type)
open("./de431.eph", O_RDONLY)          = -1 EOVERFLOW (Value too large for defined data type)
--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0} ---
+++ killed by SIGSEGV +++
Segmentation fault

Might the FILE pointer be NULL for some reason?...

I would apreciate very much for some help.

Kind regards,

JKepler

WinInet callback not called when the main thread sleeps

$
0
0
Hi, All,

I tried to use WinInet API to send a Http request and get back a page asynchronously, with the main thread waiting until the response is received in the callback function. However, it does not seem to work because the callback function is never invoked if the main thread sleeps. Anyone has some idea what is going on? If the main thread does not wait sleeping, it works fine.

Thanks at lot!
Viewing all 3016 articles
Browse latest View live