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
U

User 3919723

@User 3919723
About
Posts
12
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Checking Internet Connection
    U User 3919723

    try with

    #include
    #pragma comment(lib,"Wininet.lib")

    C / C++ / MFC c++ tutorial question

  • Time Format
    U User 3919723

    CTime::GetCurrentTime() returns a CTime object, not a string, so it has not a format. To get the formatted string, have you used the CTime::Format function? Use it with %I instead of %H. P.S.: you cannot read the documentation on MSDN?

    C / C++ / MFC question

  • Memory Bits To Bitfield Definition
    U User 3919723

    If I understood, you can try with a union: union FIELDEX { struct FIELD { uint8_t b0:1; uint8_t b1:1; uint8_t b2:1; uint8_t b3:1; uint8_t b4:1; uint8_t b5:1; uint8_t b6:1; uint8_t b7:1; } fld; uint8_t val; }; FIELDEX test; test.val = 0x7A; // 0111 1010 test.fld.b0 = 1; // set bit 0

    C / C++ / MFC hardware performance tutorial question

  • Edit Control
    U User 3919723

    To get the text portion currently selected? See CEdit::GetSel.

    C / C++ / MFC help tutorial

  • function doesn't reply
    U User 3919723

    Please, don't give such a bad solution!!! I've adjusted it to avoid global variables:

    #include #include bool solver(float a,float b, float c, float &x1, float &x2)
    {
    float delta = sqrt( (b*b) - (4*a*c) );

    if (!a)  return false; 
    
    x1 = ( -b + delta)/(2\*a);
    x2 = ( -b - delta)/(2\*a);
    
    return true;
    

    }

    int main()
    {
    float a=2,
    b=4,
    c=-30;

    /*
    printf("a = ");
    scanf("%f", &a);
    printf("b = ");
    scanf("%f", &b);
    printf("c = ");
    scanf("%f", &c);

    */

    float x1,x2;
    if ( solver(a, b ,c, x1, x2) ) printf("x1=%f\nx2=%f\n",x1,x2);

    return 0;
    }

    C / C++ / MFC help

  • Hiding Controls Dynamically in Dialog
    U User 3919723

    You have lot of controls? Why don't you use a function? Example:

    void CFacePlate::SetDlgItemVisible(int idCtrl, int iTagType)
    {
    if (oTagBase->GetTagType() == iTagType)
    {
    GetDlgItem(idCtrl)->ShowWindow(SW_SHOW);
    }
    else
    {
    GetDlgItem(idCtrl)->ShowWindow(SW_HIDE);
    }
    }

    BOOL CFacePlate::OnInitDialog()
    {
    CDialog::OnInitDialog();
    SetDlgItemVisible(IDC_STATECOMBO, INDICATOR);
    SetDlgItemVisible(IDC_SPVALUE, CONTROLLER);
    }

    C / C++ / MFC question wpf

  • Get System Shutdown notification
    U User 3919723

    I think you cannot suspend the shutdown process, but you can cancel it returning FALSE to the WM_QUERYENDSESSION message. Maybe, while you are in your WM_QUERYENDSESSION message handler, the shutdown process is suspended, except when ExitWindowsEx was called with the flag EWX_FORCEIFHUNG, but I'm not sure about that.

    C / C++ / MFC c++ tutorial question

  • How to get A WindowHandle from a process Id
    U User 3919723

    The handle of what window? To retrieve all windows of a process, you have to call EnumWindows and, for each window, use GetWindowThreadProcessId to check if a window belongs to a process (the ProcessID of the window equals the ProcessID of the process).

    C / C++ / MFC tutorial

  • access dynamically allocated structure
    U User 3919723

    is CheckSumPair not CheckSumPair*, so you can't use "->", use "." instead. Instruction "CSPair[x]->.weakcs" contains "->" and ".". Why malloc? use the new operator instead:

    CheckSumPair* CSPair = new CheckSumPair[10];

    or better, if possible:

    CheckSumPair CSPair[10];

    And finally, you have to explain what are you trying to do with the two strncpy, maybe your code has to be like:

    #define UINT32 unsigned int
    #define INT32 int
    #define UCHAR unsigned char

    typedef struct
    {
    UINT32 weakcs; // The weak, rolling Adler32 checksum.
    UCHAR StrongCS[10 + 1]; // including the string terminator
    UCHAR StrongCSString[10 + 1]; // including the string terminator
    } CheckSumPair;

    int main()
    {
    CheckSumPair CSPair[10];

    for(int x = 0; x < 10; x++)
    {
    	CSPair\[x\].weakcs = (UINT32)x+1;
    	strncpy((char\*)CSPair\[x\].StrongCS, "XYZ", 10);
    	strncpy((char\*)CSPair\[x\].StrongCSString, "CEDVCD", 10);
    }
    
    
    for(int x = 0; x < 10; x++)
    {
    	printf("%d %s %s\\n\\n", CSPair\[x\].weakcs, CSPair\[x\].StrongCS, CSPair\[x\].StrongCSString);
    }
    
    return 0;
    

    }

    C / C++ / MFC performance help tutorial question

  • COM DLL ProgID is not created
    U User 3919723

    Maybe you need to check HRESULT to see what is wrong. However, have you called CoInitialize or CoInitializeEx first? And finally, you can write: HRESULT hres = sobj.CreateInstance(OLESTR("ScriptObj.ScriptObj"));

    C / C++ / MFC com

  • Problem with Win32 Threads
    U User 3919723

    LPTHREAD_START_ROUTINE is defined as: typedef DWORD (WINAPI *PTHREAD_START_ROUTINE)( LPVOID lpThreadParameter ); typedef PTHREAD_START_ROUTINE LPTHREAD_START_ROUTINE; so, your thread function is to be: static DWORD WINAPI Threadi(LPVOID lpThreadParameter) { System::Windows::Forms::MessageBox::Show("Hi there!"); return 0; }

    C / C++ / MFC data-structures c++ security help question

  • How to read command line arguments in vc++
    U User 3919723

    GetCommandLine ?

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