Tool Box : Not the same on Release and Debug mode, why ?
Hi,
Look the 2 screenshots. The first one is in Debug mode, and the tool box correctly displayed. On the seconde one, Release mode. Why it''s different ?
Debug Mode :
Release Mode :
========================
Leyder Dylan (dylan.leyder@slug-production.be.tf
http://www.slug-production.be.tf/
It looks like the Release mode dialog has a Transparent style. Either that, or it isn''t processing its paint messages correctly.
---
K-1 Productions: Come visit us here.
---
K-1 Productions: Come visit us here.
No, the function return false.
Here''s the full fonction :
========================
Leyder Dylan (dylan.leyder@slug-production.be.tf
http://www.slug-production.be.tf/
Here''s the full fonction :
// The Dialog Boxbool CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM /*lParam*/){ switch(uMsg) { case WM_INITDIALOG: { // We fill the Dialog Box SendMessage(GetDlgItem(hwndDlg, IDC_EDIT1), WM_SETTEXT, 0, (LPARAM)TEXT(Texture_Path)); SendMessage(GetDlgItem(hwndDlg, IDC_EDIT2), WM_SETTEXT, 0, (LPARAM)TEXT("First, use the ''Select the T3D File ...'' button")); SendMessage(GetDlgItem(hwndDlg, IDC_EDIT3), WM_SETTEXT, 0, (LPARAM)TEXT("Please enter the converted file name here")); SendMessage(GetDlgItem(hwndDlg, IDC_EDIT4), WM_SETTEXT, 0, (LPARAM)TEXT(Texture_Extension)); SendMessage(GetDlgItem(hwndDlg, IDC_EDIT5), WM_SETTEXT, 0, (LPARAM)TEXT(Font_Texture_Path)); return true; } case WM_COMMAND: { switch(LOWORD(wParam)) { case IDC_CONVERT: { if (SendMessage(GetDlgItem(hwndDlg, IDC_RADIO1), BM_GETSTATE, 0, 0) == BST_CHECKED) Reserved_Texture = true; else Reserved_Texture = false; // ********************************* // TEXTURE PATH EDIT BOX *********** // ********************************* HWND hwndCtrl = GetDlgItem(hwndDlg, IDC_EDIT1); int nTextLen = SendMessage(hwndCtrl, WM_GETTEXTLENGTH, 0, 0); Texture_Path = new TCHAR[nTextLen + 1]; // Si, 1 de plus SendMessage(hwndCtrl, WM_GETTEXT, nTextLen + 1, (LPARAM)Texture_Path); // ************************************** // TEXTURE EXTENSION EDIT BOX *********** // ************************************** HWND hwndCtrl1 = GetDlgItem(hwndDlg, IDC_EDIT4); int nTextLen1 = SendMessage(hwndCtrl1, WM_GETTEXTLENGTH, 0, 0); Texture_Extension = new TCHAR[nTextLen1 + 1]; // Si, 1 de plus SendMessage(hwndCtrl1, WM_GETTEXT, nTextLen1 + 1, (LPARAM)Texture_Extension); // ********************************* // FONT TEXTURE EDIT BOX *********** // ********************************* HWND hwndCtrl2 = GetDlgItem(hwndDlg, IDC_EDIT5); int nTextLen2 = SendMessage(hwndCtrl2, WM_GETTEXTLENGTH, 0, 0); Font_Texture_Path = new TCHAR[nTextLen2 + 1]; // Si, 1 de plus SendMessage(hwndCtrl2, WM_GETTEXT, nTextLen2 + 1, (LPARAM)Font_Texture_Path); // ********************************** // T3D FILE NAME EDIT BOX *********** // ********************************** HWND hwndCtrl3 = GetDlgItem(hwndDlg, IDC_EDIT2); int nTextLen3 = SendMessage(hwndCtrl3, WM_GETTEXTLENGTH, 0, 0); T3D_File_Name = new TCHAR[nTextLen3 + 1]; // Si, 1 de plus SendMessage(hwndCtrl3, WM_GETTEXT, nTextLen3 + 1, (LPARAM)T3D_File_Name); // ********************************** // T3D CONVERTED FILE NAME EDIT BOX * // ********************************** HWND hwndCtrl4 = GetDlgItem(hwndDlg, IDC_EDIT3); int nTextLen4 = SendMessage(hwndCtrl4, WM_GETTEXTLENGTH, 0, 0); Converted_Filename = new TCHAR[nTextLen4 + 1]; // Si, 1 de plus SendMessage(hwndCtrl4, WM_GETTEXT, nTextLen4 + 1, (LPARAM)Converted_Filename); // We convert the T3D File T3D_Converter(T3D_File_Name, Texture_Path, Texture_Extension, Font_Texture_Path, Converted_Filename); return true; } case IDC_EXIT: // Exit PostMessage(hwndDlg, WM_CLOSE, 0, 0); return true; case IDC_BROWSE: { // We browse TCHAR FName[_MAX_PATH + 1]; *FName = 0; OPENFILENAME ofn = {0}; ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = hwndDlg; // Search filter to apply LPCTSTR szFilter = _T("T3D File (*.t3d)\0*.t3d\0Tous (*.*)\0*.*\0"); ofn.lpstrFilter = szFilter; ofn.nMaxFile = _MAX_PATH; ofn.lpstrTitle = _T("Choose the T3D File to convert"); ofn.Flags = OFN_EXPLORER | OFN_HIDEREADONLY; ofn.lpstrFile = FName; if(GetOpenFileName(&ofn)) // We send the name to the tool box SendMessage(GetDlgItem(hwndDlg, IDC_EDIT2), WM_SETTEXT, 0, (LPARAM)FName); } } } return false; case WM_CLOSE: EndDialog(hwndDlg, 0); // 0 indique annuler return true; } return false;}
========================
Leyder Dylan (dylan.leyder@slug-production.be.tf
http://www.slug-production.be.tf/
Hi,
I looked over your code, and found some things that could be cleared up. In general, you should never use more than one return in a function. The dialog procedure is an exception to this rule, where you can use two returns. This makes the code a little easier to read. Your dialog procedure was missing some returns/breaks in some of the command switches, so I rewrote the code, hoping to expose some of the bugs. The rewrite is virtually identical to the original code, except for the added breaks. Here it is:
NOTES: I have had this bug before, but can not remember where. I believe it has something to do with these switch/break statements in the dialog procedure. I may have forgotten already. :/
Anyway, hope this helps.
-- D3dicated
I looked over your code, and found some things that could be cleared up. In general, you should never use more than one return in a function. The dialog procedure is an exception to this rule, where you can use two returns. This makes the code a little easier to read. Your dialog procedure was missing some returns/breaks in some of the command switches, so I rewrote the code, hoping to expose some of the bugs. The rewrite is virtually identical to the original code, except for the added breaks. Here it is:
void OnIDC_BROWSE(HWND hwndDlg){ // We browse TCHAR FName[_MAX_PATH + 1]; *FName = 0; OPENFILENAME ofn = {0}; ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = hwndDlg; // Search filter to apply LPCTSTR szFilter = _T("T3D File (*.t3d)\0*.t3d\0Tous (*.*)\0*.*\0"); ofn.lpstrFilter = szFilter; ofn.nMaxFile = _MAX_PATH; ofn.lpstrTitle = _T("Choose the T3D File to convert"); ofn.Flags = OFN_EXPLORER | OFN_HIDEREADONLY; ofn.lpstrFile = FName; // We send the name to the tool box if(GetOpenFileName(&ofn)) SendMessage(GetDlgItem(hwndDlg, IDC_EDIT2), WM_SETTEXT, 0, (LPARAM)FName); }void OnIDC_CONVERT(HWND hwndDlg){ if (SendMessage(GetDlgItem(hwndDlg, IDC_RADIO1), BM_GETSTATE, 0, 0) == BST_CHECKED) Reserved_Texture = true; else Reserved_Texture = false; // ********************************* // TEXTURE PATH EDIT BOX *********** // ********************************* HWND hwndCtrl = GetDlgItem(hwndDlg, IDC_EDIT1); int nTextLen = SendMessage(hwndCtrl, WM_GETTEXTLENGTH, 0, 0); Texture_Path = new TCHAR[nTextLen + 1]; // Si, 1 de plus SendMessage(hwndCtrl, WM_GETTEXT, nTextLen + 1, (LPARAM)Texture_Path); // ************************************** // TEXTURE EXTENSION EDIT BOX *********** // ************************************** HWND hwndCtrl1 = GetDlgItem(hwndDlg, IDC_EDIT4); int nTextLen1 = SendMessage(hwndCtrl1, WM_GETTEXTLENGTH, 0, 0); Texture_Extension = new TCHAR[nTextLen1 + 1]; // Si, 1 de plus SendMessage(hwndCtrl1, WM_GETTEXT, nTextLen1 + 1, (LPARAM)Texture_Extension); // ********************************* // FONT TEXTURE EDIT BOX *********** // ********************************* HWND hwndCtrl2 = GetDlgItem(hwndDlg, IDC_EDIT5); int nTextLen2 = SendMessage(hwndCtrl2, WM_GETTEXTLENGTH, 0, 0); Font_Texture_Path = new TCHAR[nTextLen2 + 1]; // Si, 1 de plus SendMessage(hwndCtrl2, WM_GETTEXT, nTextLen2 + 1, (LPARAM)Font_Texture_Path); // ********************************** // T3D FILE NAME EDIT BOX *********** // ********************************** HWND hwndCtrl3 = GetDlgItem(hwndDlg, IDC_EDIT2); int nTextLen3 = SendMessage(hwndCtrl3, WM_GETTEXTLENGTH, 0, 0); T3D_File_Name = new TCHAR[nTextLen3 + 1]; // Si, 1 de plus SendMessage(hwndCtrl3, WM_GETTEXT, nTextLen3 + 1, (LPARAM)T3D_File_Name); // ********************************** // T3D CONVERTED FILE NAME EDIT BOX * // ********************************** HWND hwndCtrl4 = GetDlgItem(hwndDlg, IDC_EDIT3); int nTextLen4 = SendMessage(hwndCtrl4, WM_GETTEXTLENGTH, 0, 0); Converted_Filename = new TCHAR[nTextLen4 + 1]; // Si, 1 de plus SendMessage(hwndCtrl4, WM_GETTEXT, nTextLen4 + 1, (LPARAM)Converted_Filename); // We convert the T3D File T3D_Converter(T3D_File_Name, Texture_Path, Texture_Extension, Font_Texture_Path, Converted_Filename);}void OnWM_COMMAND(HWND hwndDlg){ switch(LOWORD(wParam) ) { case IDC_BROWSE: OnIDC_BROWSE(hwndDlg); break; case IDC_CONVERT: // IDC_CONVERT command. OnIDC_CONVERT(hwndDlg); break; case IDC_EXIT: // Exit PostMessage(hwndDlg, WM_CLOSE, 0, 0); break; default: break } // No need to worry about returning true/false in // handling of commands from controls. // You should be handling all commands. You wrote them!}// The Dialog Boxbool CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM /*lParam*/){ switch(uMsg) { case WM_INITDIALOG: // We fill the Dialog Box SendMessage(GetDlgItem(hwndDlg, IDC_EDIT1), WM_SETTEXT, 0, (LPARAM)TEXT(Texture_Path) ); SendMessage(GetDlgItem(hwndDlg, IDC_EDIT2), WM_SETTEXT, 0, (LPARAM)TEXT("First, use the ''Select the T3D File ...'' button")); SendMessage(GetDlgItem(hwndDlg, IDC_EDIT3), WM_SETTEXT, 0, (LPARAM)TEXT("Please enter the converted file name here")); SendMessage(GetDlgItem(hwndDlg, IDC_EDIT4), WM_SETTEXT, 0, (LPARAM)TEXT(Texture_Extension)); SendMessage(GetDlgItem(hwndDlg, IDC_EDIT5), WM_SETTEXT, 0, (LPARAM)TEXT(Font_Texture_Path)); break; case WM_COMMAND: OnWM_COMMAND(hwndDlg); break; case WM_CLOSE: EndDialog(hwndDlg, 0); // 0 indique annuler break; default: return false; } return true;}
NOTES: I have had this bug before, but can not remember where. I believe it has something to do with these switch/break statements in the dialog procedure. I may have forgotten already. :/
Anyway, hope this helps.
-- D3dicated
I did happen to have that problem too.
Once it was because the fuction did not return false
the other time, I was not able to find why it did so
Once it was because the fuction did not return false
the other time, I was not able to find why it did so
MS VC ++ 5.0
========================
Leyder Dylan (dylan.leyder@slug-production.be.tf
http://www.slug-production.be.tf/
========================
Leyder Dylan (dylan.leyder@slug-production.be.tf
http://www.slug-production.be.tf/
I had the problem with VC++ 6
But, not since I switched to VC++ .NET nor the .NET 2003
you should upgrade
But, not since I switched to VC++ .NET nor the .NET 2003
you should upgrade
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement