Click here to Skip to main content
15,896,484 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionInheritance classes Pin
kinderu16-Jul-16 20:32
kinderu16-Jul-16 20:32 
AnswerRe: Inheritance classes Pin
Daniel Pfeffer16-Jul-16 20:45
professionalDaniel Pfeffer16-Jul-16 20:45 
AnswerRe: Inheritance classes Pin
Albin George18-Jul-16 1:14
Albin George18-Jul-16 1:14 
QuestionUnmanaged DLL used by C# WPF app not receiving WM_DEVICECHANGE Pin
Leif Simon Goodwin15-Jul-16 3:07
Leif Simon Goodwin15-Jul-16 3:07 
QuestionRe: Unmanaged DLL used by C# WPF app not receiving WM_DEVICECHANGE Pin
David Crow15-Jul-16 5:59
David Crow15-Jul-16 5:59 
AnswerRe: Unmanaged DLL used by C# WPF app not receiving WM_DEVICECHANGE Pin
Leif Simon Goodwin17-Jul-16 3:11
Leif Simon Goodwin17-Jul-16 3:11 
AnswerSolved Pin
Leif Simon Goodwin17-Jul-16 20:42
Leif Simon Goodwin17-Jul-16 20:42 
QuestionDirectX 9 in code:blocks fails on initD3D Pin
Korowai14-Jul-16 9:10
Korowai14-Jul-16 9:10 
Hello,

i am trying to handle problem with directX 9 and code:blocks.
i searched the internet and after installing the sdk properly and used a tutorial to compile the directx code in an static control window of my winapi program. The IDE doesn't give an error, but instead of compiling a grey window the code only does a black window over the other dialog elements, who won't be compiled properly on screen. The programm doesn't shutdown and the window bar still is in function.

Does anyone knows what's to do?

Here ist the code in cuts:

C++
void initD3D(HWND hDlg30)
{
    d3d = Direct3DCreate9(D3D_SDK_VERSION);    

    D3DPRESENT_PARAMETERS d3dpp;    

    ZeroMemory(&d3dpp, sizeof(d3dpp));    
    d3dpp.Windowed = TRUE;    
    d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;    
    d3dpp.hDeviceWindow = hDlg30;    

    d3d->CreateDevice(D3DADAPTER_DEFAULT,
                      D3DDEVTYPE_HAL,
                      hDlg30,
                      D3DCREATE_SOFTWARE_VERTEXPROCESSING,
                      &d3dpp,
                      &d3ddev);
}

HRESULT CreateDevice(UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags,
                     D3DPRESENT_PARAMETERS *pPresentationParameters, IDirect3DDevice9 **ppReturnedDeviceInterface);

void render_frame(void)
{
    d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(70, 70, 70), 1.0f, 0);

    d3ddev->BeginScene();    

    d3ddev->EndScene();    

    d3ddev->Present(NULL, NULL, NULL, NULL);    
}

void cleanD3D(void)
{
    d3ddev->Release();    
    d3d->Release();    
}


And this is the dialog code so far:

C++
BOOL CALLBACK RaumkarteProc(HWND hDlg30, UINT message, WPARAM wParam, LPARAM lParam)
{
    PAINTSTRUCT ps;
    HDC hdc;
    HDC hdcZeichnung;
    RECT rect;

    static HWND hwndRaumkarteAktion1, hwndRaumkarteAktion2,
    hwndRaumkarteHScroll, hwndRaumkarteVScroll, hwndRaum;
    int AnzahlGegner;
    static int rightWidth=1100;
    static int lowerHeight=650;
    static int leftWidth=300;
    static int upperHeight=50;
    bool Kartezeichnen=true;
    static int iAktions1index;
    static int Aktion1auslesen;
    static char Aktion1auswahl[100];
    int Kartenmobilanzahl;
    Kartenmobilanzahl=Zufallsgegner_Raum.size();
    hwndRaum=GetDlgItem(hDlg30,ID_RAUMKARTE31);
    initD3D(hDlg30);

    switch (message)
    {
        case WM_INITDIALOG:
        {
            SendDlgItemMessage(hDlg30, ID_RAUMKARTEAKTIONSLISTE34,LB_ADDSTRING,NULL,(LPARAM)"Flug");
            SendDlgItemMessage(hDlg30, ID_RAUMKARTEAKTIONSLISTE34,LB_ADDSTRING,NULL,(LPARAM)"Feuergefecht");
            SendDlgItemMessage(hDlg30, ID_RAUMKARTEAKTIONSLISTE34,LB_ADDSTRING,NULL,(LPARAM)"Planet");
            SendDlgItemMessage(hDlg30, ID_RAUMKARTEAKTIONSLISTE34,LB_ADDSTRING,NULL,(LPARAM)"Handelsdock/ Basis");
            SendDlgItemMessage(hDlg30, ID_RAUMKARTEAKTIONSLISTE34,LB_ADDSTRING,NULL,(LPARAM)"Kom Kanal");
            SendDlgItemMessage(hDlg30, ID_RAUMKARTEAKTIONSLISTE34,LB_ADDSTRING,NULL,(LPARAM)"Scan");
            SendDlgItemMessage(hDlg30, ID_RAUMKARTEAKTIONSLISTE34,LB_ADDSTRING,NULL,(LPARAM)"Ladung abwerfen");
            SendDlgItemMessage(hDlg30, ID_RAUMKARTEAKTIONSLISTE34,LB_ADDSTRING,NULL,(LPARAM)"Ladung tauschen");
            SendDlgItemMessage(hDlg30, ID_RAUMKARTEAKTIONSLISTE34,LB_ADDSTRING,NULL,(LPARAM)"Runde abschließen");
        return FALSE;
       };
       case WM_PAINT:
            {
                if (Kartezeichnen==true)
                {
                    render_frame();
                }
            }
            break;

        case WM_COMMAND:

         switch (LOWORD (wParam))
            {

case WM_KEYDOWN:
    {
        return FALSE;
    }

case WM_SIZE:
    {
        return FALSE;
    }
    case VK_ESCAPE:
        {
                cleanD3D();
                EndDialog(hDlg30,0);
                return TRUE;
        }

        case ID_RAUMKARTEAKTIONSLISTE34:
            {
                if (LOWORD(wParam)==ID_RAUMKARTEAKTIONSLISTE34&&HIWORD(wParam)==LBN_DBLCLK)
           {
               iAktions1index=SendMessage(GetDlgItem(hDlg30, ID_RAUMKARTEAKTIONSLISTE34), LB_GETCURSEL,0,0);
               Aktion1auslesen=SendMessage(GetDlgItem(hDlg30, ID_RAUMKARTEAKTIONSLISTE34),LB_GETTEXT,iAktions1index,(LPARAM)Aktion1auswahl);

               if (strcmp(Aktion1auswahl, "Flug")==0)
               {
                   Zielfadenkreuz==true;

                   UpdateWindow(hDlg30);
                   SendDlgItemMessage(hDlg30, ID_RAUMKARTEWAHLAKTIONSLISTE35,LB_ADDSTRING,NULL,(LPARAM)"Flug ausfuehren");
                   SendDlgItemMessage(hDlg30, ID_RAUMKARTEWAHLAKTIONSLISTE35,LB_ADDSTRING,NULL,(LPARAM)"Flugmodus beenden");
                   return FALSE;

               }
               else if (strcmp(Aktion1auswahl, "Runde abschließen")==0)
               {
                cleanD3D();


                EndDialog(hDlg30,0);

                   return TRUE;
               }
           }
                return FALSE;
            }
            }
            break;
        }
        return FALSE;
}

AnswerRe: DirectX 9 in code:blocks fails on initD3D Pin
leon de boer14-Jul-16 18:13
leon de boer14-Jul-16 18:13 
GeneralRe: DirectX 9 in code:blocks fails on initD3D Pin
Korowai15-Jul-16 6:04
Korowai15-Jul-16 6:04 
GeneralRe: DirectX 9 in code:blocks fails on initD3D Pin
Korowai1-Aug-16 16:19
Korowai1-Aug-16 16:19 
Questionbehaviour when adding custom buttons to CMFCToolBar with CMFCToolBar::ReplaceButton? Pin
Maximilien13-Jul-16 10:27
Maximilien13-Jul-16 10:27 
QuestionCalling C Function in Dll Causing Problem Pin
Django_Untaken12-Jul-16 4:52
Django_Untaken12-Jul-16 4:52 
SuggestionRe: Calling C Function in Dll Causing Problem Pin
Richard MacCutchan12-Jul-16 5:19
mveRichard MacCutchan12-Jul-16 5:19 
GeneralRe: Calling C Function in Dll Causing Problem Pin
Django_Untaken12-Jul-16 5:27
Django_Untaken12-Jul-16 5:27 
AnswerRe: Calling C Function in Dll Causing Problem Pin
Albert Holguin12-Jul-16 5:59
professionalAlbert Holguin12-Jul-16 5:59 
GeneralRe: Calling C Function in Dll Causing Problem Pin
Django_Untaken12-Jul-16 7:18
Django_Untaken12-Jul-16 7:18 
GeneralRe: Calling C Function in Dll Causing Problem Pin
Albert Holguin13-Jul-16 6:36
professionalAlbert Holguin13-Jul-16 6:36 
GeneralRe: Calling C Function in Dll Causing Problem Pin
mariakatosvich13-Aug-16 2:28
mariakatosvich13-Aug-16 2:28 
GeneralRe: Calling C Function in Dll Causing Problem Pin
Richard MacCutchan12-Jul-16 6:08
mveRichard MacCutchan12-Jul-16 6:08 
QuestionNcPaint and Invalid rect/region Pin
Сергей Шевченко12-Jul-16 2:00
Сергей Шевченко12-Jul-16 2:00 
AnswerRe: NcPaint and Invalid rect/region Pin
leon de boer12-Jul-16 2:33
leon de boer12-Jul-16 2:33 
GeneralRe: NcPaint and Invalid rect/region Pin
Сергей Шевченко12-Jul-16 4:15
Сергей Шевченко12-Jul-16 4:15 
QuestionCalling a method with the pointer to a base class Pin
FriendOfAsherah10-Jul-16 21:11
FriendOfAsherah10-Jul-16 21:11 
AnswerRe: Calling a method with the pointer to a base class Pin
Jochen Arndt10-Jul-16 21:47
professionalJochen Arndt10-Jul-16 21:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.