|
Check to see if you're not initializing any pointers to 0. Debug mode will do this for you, but in release mode, a pointer may start off with a garbage value, and consequently, if you try to use it, any one of a number of weird things can happen.
|
|
|
|
|
Hello,
I am working on a Win32 application in C/C++ using Visual Studio 2003.
There is a feature to write application data to a CD. This feature works fine. The issue is with, when the User enters a CD to the drive the application should be able to auto detect that and prompt the User.
Is there a Windows function to do that?
Is there a function which will retrieve whether a CD has been inserted to the CD Drive?
Thanks in advance!
|
|
|
|
|
Handle the WM_DEVICECHANGE message. The event will be DBT_DEVICEARRIVAL .
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
if I define a function like
int MakeBigger(int nVal1, int nVal2, int nMultiplier )
{
int nRetValue;
nRetValue = (nVal1+nVal2) * nMultiplier;
return (nRetValue);
}
is it necessary that the default parameter (nMultiplier) be the last parameter in the list?
For example, could the following be valid:
int MakeBigger(int nVal1, int nMultiplier, int nVal2)
{
}
or also
int MakeBigger(int nMultiplier, int nVal1, int nVal2)
{
}
ALSO
Is it valid to have more than one default parameter? AND what is the correct syntax:
int MyFn(int nDefaultParam)
OR
int MyFn(int nDefaultParam=2)
Thanks,
Johnny
|
|
|
|
|
Default parameters must be last in your function definitions.
You can have more than one default parameter:
int MyFn(int nParam1, bool bRequired = true, float fMultiplier = 2.26);
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
Thanks!
I have seen two types of syntax regarding the definition of the default values:
void MyFn(int nDefault)
and
void MyFn(int nDefault=2)
Which is "proper"?
|
|
|
|
|
john john mackey wrote: Which is "proper"?
Only the latter since the former is just a comment.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
void MyFn(int nDefault=2) is necessary somewhere in the code. If you declare this function in a class, then put this code in the class. If you are declaring it before the function call and definition, you can declare it like this as well. Then, you can use void MyFn(int nDefault/*=2*/) when you define the function.
Otherwise, when you define the function, you must write void MyFn(int nDefault=2) as the function header.
|
|
|
|
|
The second one would be the prototype and the first one would be the actual function.
void MyFn(int nDefault=2);
void MyFn(int nDefault)
{ ... }
The only reason for applying the second one to the functions is so that it reflects the prototype (a.k.a. documents prototype parameter).
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
Which is a bad practice. Since modification of default value would need to change two places in code...
|
|
|
|
|
Does anybody know how the NTVDM.EXE, launched CREATE_SEPARATE_WOW_VDM via CreateProcess, shuts itself down.
I have a 16bit app and a 16bit DLL. Lets assume that the 16 bit DLL allocates some resources and then frees them in the WEP function.
The 16 bit app is created via 32bit call CreateProcess with CREATE_SEPARATE_WOW_VDM. However, upon 16 bit app termination, the 16 bit DLL WEP function is not automatically called.
The 16bit DLL WEP code IS called when CREATE_SHARED_WOW_VDM flags settings is used. Does anyone know why or have they seen this behavior before?
I am starting to get alot of insufficient resources error messages and was wondering is it related. Now, it is completely feasible that there are other memory/resource leaks in the 16bit app/dll. I'm just trying to rule this out first.
Error message =
The Win 16 Subsystem has insufficent resources to continue running. Click on OK, close your applications, and restart your machine.
|
|
|
|
|
Hello,
After I have added some new controls to dialog and add variables related with these new controls
,application crashes.( no crash after controls are added but related variable are not defined) When I break application and try to debug it , I saw that it is crashing
within void Reallocate( _In_ int nLength ) function of CSimpleStringT class.Any comments ...
|
|
|
|
|
Can you remove all of the related variables and then add them back in one at a time until the problem appears?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I have already remove all latest added control, and try to put one bye one and change their IDs also. I got the some result.As soon as first variable defined after first control is put onto dialog , it crashes.
|
|
|
|
|
Bilge Kaan wrote: ...it crashes.
Exception, assertion, or some other anomaly?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi,
I am working on one C++ DLL. That dll is internally using some statically build common.lib. When I am building the DLL, I am getting following linking errors:
Creating library Release Standard Heap/paecustomactions.lib and object Release Standard Heap/paecustomactions.exp
common.lib(properocommon.obj) : error LNK2019: unresolved external symbol __imp__mymalloc referenced in function _MIDL_user_allocate@4
common.lib(properocommon.obj) : error LNK2019: unresolved external symbol __imp__myrealloc referenced in function "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl PROPERO::FormatStringA(char const *,...)" (?FormatStringA@PROPERO@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBDZZ)
common.lib(hcheapfix.obj) : error LNK2019: unresolved external symbol __imp__myfree_cond referenced in function _myfree
common.lib(sysconfig.obj) : error LNK2019: unresolved external symbol __imp__mycalloc referenced in function "public: __thiscall PROPERO::Runnable::Runnable(int,int,unsigned short const *)" (??0Runnable@PROPERO@@QAE@HHPBG@Z)
common.lib(stackTrace32.obj) : error LNK2001: unresolved external symbol __imp__mycalloc
../bin/i386/release/paecustomactions.dll : fatal error LNK1120: 4 unresolved externals
Can you please guide me to solve this issue?
Thanks in advance
|
|
|
|
|
Reason :-
1. Did u included the include file of systemconfig.h, propercommon.h etc in your project along with the library?
2. Common.lib is again referencing some other libs, you need to find those libs which common.lib is referencing.
and check
http://msdn.microsoft.com/en-us/library/799kze2z(VS.71).aspx[^]
modified on Friday, July 10, 2009 8:57 AM
|
|
|
|
|
1) Find the library that implements those functions and link to it.
or
2) Write implementations for those functions.
It looks to me like your DLL wants to link against another DLL - that's what the __imp__ prefix on the undefined external names implies to me...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I am doing custom drawing of my header control in listview, that time i would like to know the image number associated with the column. The column doesn't have any image associated to it,has the image number as -1, this is the default value.
I am using Header_GetItem macro to identify the column details. I am getting all the detials like Name of the column, Width of the column correctly, but the image number is wrong. The image number always comes as 0 for the column not associated with any image. But it should come as -1.
HDITEM pColItem;
pColItem.mask = HDI_TEXT |HDI_FORMAT |HDI_IMAGE ;
pColItem.pszText = wcBuf;
pColItem.cchTextMax = 255;
pColItem.iImage = I_IMAGECALLBACK;
Header_GetItem(HederHandle,nColIndex,&pColItem);
Can anyone please help me how to rectify this problem?
|
|
|
|
|
I am using Microlsoft Visual Studio 6.00.
I am creating a new frame using CreateNewFrame(). At the time of creation of class I derive the class from CScrollView. I want to paint the background of the view with some color. So I am using SetBkColor as
pDC->SetBkColor(RGB(255,0,0))
Here 'pDC' is of OnDraw() method.
But it can't work.
Plz tell me how can I paint the background window.
Regards
Nikesh
|
|
|
|
|
I hope this will help you [^]
|
|
|
|
|
i have created a sample application with SetCursorPos().
this application moves the mouse cursor to a certain extent when clicking on a button.
This application works fine with my system.
However it doesnt work in VMware workstation. why?
|
|
|
|
|
http://communities.vmware.com/thread/189519[^]
Please see below :-
In order for SetCursorPos() or Mouse_Event() to behave the way you would expect, you can disable the absolute mouse and host cursor offload, by adding the following to the VM's .vmx file and rebooting.
vmmouse.present = FALSE
modified on Friday, July 10, 2009 8:52 AM
|
|
|
|
|
Hi,
I am trying to enable Boost multi threading in Visual Studio 2003.
<br />
#include < boost/thread/thread.hpp >
#include < boost/lambda/lambda.hpp >
int main()<br />
{ <br />
<br />
<br />
return 0;<br />
}<br />
I went to PROJECT -> PROPERTIES -> C/C++ -> COMMAND LINE and added /MT
but I get the following compile errors
<br />
main Command line warning D4025 : overriding '/MLd' with '/MT'<br />
main Command line warning D4025 : overriding '/MT' with '/MLd'<br />
main Command line warning D4025 : overriding '/MLd' with '/MT'<br />
main fatal error LNK1104: cannot open file 'libboost_thread-vc71-mt-sgd-1_38.lib'<br />
does anyone know how to switch it on? Had a scout round on the net but to no avail
Thanks for any information.
|
|
|
|
|
You set that with the C/C++->Code Generation->Runtime Library project property rather than on the command-line. Also, you need to set different options for Debug and Release builds.
[edit] And please remove the /MT from the Command Line properties![/edit]
In addition, you either haven't told the linker where to find the Boost libraries (use the Linker->General->Additional Library Directories project property) or haven't built them completely (or did you use the Boost Consulting installer?).
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|