|
anilFirst wrote: error occurred at the end of development when changed to Release mode ONLY....What you do?
Testing, that’s how you solve this problem. You should be testing the code base as you add features.
In other words at the very least stop development every once and a while and build a release version. Test all of features possible to insure everything works.
ZeePain! wrote: This seems like one of those programs that started small, grew incrementally, building internal pressure, and finally barfed all over its source code sneakers. Or something.
thedailywtf.com[^]
|
|
|
|
|
When you're developing an application it is generally done using a debug build. The developer should build a release build from time to time to make sure no weird stuff is going on (release mode only bugs). Obviously the QA department should be testing the release builds. If you get a release only bug I have found that often the cause is related to the fact that in a debug build uninitialized locals are initialized to 0xCCCCCCCC (interestingly 0xCC in an __asm int 3 which is a breakpoint) but in release build no initialization is performed. The /GZ compiler option (Catch Release-Build Errors in Debug Build) can be a big help. Among other things this suppresses the 0xCCCCCCCC fill. This often makes the release only bugs show up in debug builds.
Steve
|
|
|
|
|
Hi,
does anybody know how I can setup a DLL having its own Dialogprocedure?
I have tried with LoadLibrary/GetProcadress etc. I am able to call any functions that
are within the DLL. But when i Try to do a DialogBox(....) it seems to be rather "complicated".
I keep getting the 1814 error (The specified resource name cannot be found in the image file)
I have tried to have all files available in same directory. No Luck. My Code looks like this:
HINSTANCE hDll;
FARPROC aDll;
int rc;
hDll = LoadLibrary((LPSTR)"test.dll");
if ((int)hDll < HINSTANCE_ERROR)
{
ErrMsg();
return(0);
}
aDll = GetProcAddress(hDll, (LPSTR)"TestDialog");
if (aDll==0)
{
ErrMsg();
return(0);
}
rc = DialogBox(hInst, (LPCTSTR)IDD_TEST_DIALOG, hWnd, (DLGPROC) aDll);
if (rc==-1)
ErrMsg();
And i have tried to use the MAKEINTRESOURCE instead. No luck.
Seems to be something with in connection with the Resourcefile, but I am not able to find the one thing that might help me.
We are using Visual C++ 6.0. But we are not using any C++ related programming at all.
It is all pure C-code but with exentsion of *.cpp
Rgds
Torben
|
|
|
|
|
torbeli wrote: rc = DialogBox(hInst, (LPCTSTR)IDD_TEST_DIALOG, hWnd, (DLGPROC) aDll);
try changing to
DialogBox(hDll , (LPCTSTR)IDD_TEST_DIALOG, hWnd, (DLGPROC) aDll);
-Prakash
|
|
|
|
|
Tried it. AND IT WORKED. for (i=0; i<1000; i++) Thanks!
One of those 2 days problem solved within 5 minutes having somebody else looking at it!
I, for some reason got confused about the explanation of the DialogBox.
"Handle to application instance". I saw that as the handle to my .exe and not the new DLL
But now I can see that it make sence to use the new handle that I just created with LoadLibrary.
int DialogBox(
HINSTANCE hInstance, // handle to application instance
LPCTSTR lpTemplate, // identifies dialog box template
HWND hWndParent, // handle to owner window
DLGPROC lpDialogFunc // pointer to dialog
Many thanks
Rgds
Torben
|
|
|
|
|
torbeli wrote: int DialogBox(
HINSTANCE hInstance, // handle to application instance
LPCTSTR lpTemplate, // identifies dialog box template
HWND hWndParent, // handle to owner window
DLGPROC lpDialogFunc // pointer to dialog
I think the documentation assumed that the dialog resource would be in the application.
Since in this case the dialog is in the dll, the the instance handle of the dialog should have been passed to the API.
torbeli wrote: for (i=0; i<1000; i++) Thanks!
You are welcome, I am glad that your problem is solved.
-Prakash
|
|
|
|
|
Can i type cast a function ?{{NO}}
say i have a function as
void Fun(int);
I have a function pointer
void(*p_fun)(int,int);
Can i type cast the p_fun to point to fun .
I know logically this is a big error but is it possible syntactically.
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
p_fun has been declared that it is a pointer to a funtion with 2 params, so AFIK its not going to work.
-Prakash
|
|
|
|
|
The sample code below illustrates how to use function pointers to call functions that take different parameters than those with which the pointer was declared. The function is cast to the type of the function pointer during the first assignment, then the function pointer is cast to the type of the function to be called. Using typedefs generally makes it easier than casting the pointer directly.
#include <stdio.h>
typedef int (*myintchartype) (char *, char *);
typedef void (*myvoidtype) (void);
typedef int (*myintvoidtype) (void);
int func1(char *, char *);
void func2(void);
void main(void)
{
myintvoidtype ptr;
ptr = (myintvoidtype) func1;
((myintchartype) ptr)("one", "two");
ptr = (myintvoidtype) func2;
((myvoidtype) ptr)();
}
int func1(char *a, char *b)
{
return printf("func1 took two parameters: %s and %s\n", a, b);
}
void func2(void)
{
printf("func2 did not take any parameters\n");
}
You can type cast functions.
Love Forgives--Love Gives--Jesus is Love <marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" style="background-color:'#44ccff'">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
u had to declare a function pointer thats 1 param or diff param, can you do the casting without that ?
-Prakash
|
|
|
|
|
hey i'm curious to know your name. if it's a Top-Secret you can just mail me. so that i'll start calling you with your name here.
"But your mind is very complex, very tricky. It makes simple things complicated. -- that's its work. And for centuries it has been trained for only one thing: to make things so complicated that your life becomes impossible."- Osho
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
|
|
|
|
|
T-1000 wrote: hey i'm curious to know your name.
T-1000 wrote: if it's a Top-Secret you can just mail me
T-1000 wrote: so that i'll start calling you with your name here
Love Forgives--Love Gives--Jesus is Love <marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" style="background-color:'#44ccff'">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
hey i'm curious to know your name. if it's a Top-Secret you can just mail me. so that i'll start calling you with your name here.
"But your mind is very complex, very tricky. It makes simple things complicated. -- that's its work. And for centuries it has been trained for only one thing: to make things so complicated that your life becomes impossible."- Osho
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
|
|
|
|
|
he he
Love Forgives--Love Gives--Jesus is Love <marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" style="background-color:'#44ccff'">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
so my friends is called "he-he".. okay..okay.. nice name buddy!
"But your mind is very complex, very tricky. It makes simple things complicated. -- that's its work. And for centuries it has been trained for only one thing: to make things so complicated that your life becomes impossible."- Osho
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
|
|
|
|
|
CIA is after me.
Love Forgives--Love Gives--Jesus is Love <marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" style="background-color:'#44ccff'">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
I dont know what difference do a name make ??
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
Anything is possible if you use C style casting. You could, for example, get a void pointer to the function and then cast the void pointer back to p_fun.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
MDI application. How to resize childFrame to fit view, which is determined by grid control. They size of grid control changes. I want ChildFrame change correspondingly.
Thank you in advance.
|
|
|
|
|
ResizeParentToFit
This method allows the size of your view to dictate the size of its frame window. This is recommended only for views in MDI child frame windows. Use ResizeParentToFit in the OnInitialUpdate handler function of your derived view class.
ResizeParentToFit assumes that the size of the view window has been set. If the view window size has not been set when ResizeParentToFit is called, you will get an assertion. To ensure that this does not happen, make the following call before calling ResizeParentToFit:
GetParentFrame()->RecalcLayout();
Love Forgives--Love Gives--Jesus is Love <marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" style="background-color:'#44ccff'">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
I have two edit boxes. By default edit boxes allow copy, cut, paste and delete features. But now i should not allow copy, cut, paste and delete features in edit boxes.
knarasimharao
|
|
|
|
|
Override the WM_CUT, WM_COPY and WM_PASTE handlers.
You can leave the handlers empty.
Love Forgives--Love Gives--Jesus is Love <marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" style="background-color:'#44ccff'">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
I have a static control(derived from CStatic) and rich edit controls and it contains two lines. I want to set the color of the first line to blue and the second line to red. Currently I am using the CDialog::OnCtlColor and using the SetTextColor function to set the color. However it sets the color for the whole static control i.e. both the lines. Can someone help?
knarasimharao
|
|
|
|
|
Just an out line of procedure. customizee as you like
HWND hRichEdit = NULL;
CHARFORMAT* cf = NULL;
hRichEdit = (HWND)GetDlgItem (IDC_RICHEDIT);
CHARRANGE cr;
cr.cpMin = 0; // set strating char position
cr.cpMax = -1;// end char pos
SendMessage(hRichEdit, EM_EXSETSEL, 0, (LPARAM)&cr);
cf = new CHARFORMAT;
cf->cbSize = sizeof(CHARFORMAT);
cf->dwMask = CFM_COLOR |CFM_BOLD|CFM_FACE|CFM_SIZE|CFM_ITALIC;
cf->dwEffects = CFE_BOLD;
cf->crTextColor = RGB(255,0,0);
cf->yHeight = 160;
strcpy ( cf->szFaceName, "Ariel");
SendMessage( (HWND) hRichEdit, SCF_SELECTION, (WPARAM) SCF_ALL, (LPARAM) cf);
All the best
AnilFirst@gmail.com
|
|
|
|
|
anilFirst wrote: CHARFORMAT* cf = NULL;
Won't this work...
CHARFORMAT cf;
Love Forgives--Love Gives--Jesus is Love <marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" style="background-color:'#44ccff'">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|