|
Or you can CreateEvent() and WaitOnSingleObject() on that event if you dont want to trust sleep().
|
|
|
|
|
msnet wrote:
show me the code please
you can use QueryPerformanceCounter and QueryPerformanceFrequency too
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hi,
I'm using the VS .net 2003 compiler.
For some reason when create an instance of a class with:
ClassName instance();
the default constructor doesn't get called.
If the instance was created with:
ClassName instance;
It does call the default constructor;
The code is pretty simple:
ClassName::(void)
{
Init();
}
PS is there anyway to keep the forumn from interpretting my code as a smiley?
Thanks
Hua-Ying
|
|
|
|
|
ClassName instance(); This is an unfortunate problem with the weird C++ syntax. The above is not parsed as a an object construction, bur rather as the declaration of a function taking no arguments and returning a ClassName . Hence the problem. Just drop the () and your compiler will be happy. See this article[^] by Herb Sutter for a more detailed explanation.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Want a Boost forum in Code Project? Vote here[^]!
|
|
|
|
|
LOL, I have seen that problem and never knew why it didn't work. (Not like I really thought about it). You get it in your mind that you are declaring and instance and you don't even realize you are doing a prototype.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Hua-Ying Ling wrote:
PS is there anyway to keep the forumn from interpretting my code as a smiley?
You may insert an space between pair of characters that are interpreted as smileys. For example, inserting a space beteen a colon and a right parenthesis.
This is a smiley
This is not a smiley : )
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Hello all; I have a little problem that's been perplexing me for a bit now. Any help would be greatly appreciated.
Basically, I've written a class library that others can use to write DLL plugins for an application I'm developing. Being the thoughtful guy that I am ( ), I decided it would be nice to allow the writers of these plugins to step into routines in my class library with the Microsoft Visual C++ debugger.
The problem is that it seems the debugging information in the debug version of my library refers to its source files by absolute path - so it's possible to step into them with a debugger, but only if you have the exact same source directory structure as I used to build the library.
So what I'm wondering is, is there an easy way to make it convenient for the users to step into my library at debug-time? Will they be forced to replicate my directory structure, or is there a better way?
I'm using Microsoft Visual C++ 6.
[Insert witty and relevant signature here]
|
|
|
|
|
In my experience, when the IDE can't find a source file in the exact path indicated in the debug info, it prompts where to find the appropriate file. The next files it need to open will then be picked from the same folder.
Another possibility that may work in some situations (e.g.: a small team of developers) is to use mapped network drives as a way to introduce an indirection. I'm not talking about everyone accessing the files through the network, just using the same drive letter.
For example:
Suppose that in your machine, your sources are located starting at:
C:\Projects\Useful\Shared\SuperLibrary
You can create a share for the folder at C:\Projects\Useful\Shared. You don't need to give any permission to anyone but yourself if you don't want.
You can map a network drive, say S:, to the share in your own machine created before.
Then you open the project using the network drive, that is, instead of opening the project at C:\Projects\Useful\Shared\SuperLibrary, you open the one at S:\SuperLibrary (which of course is the same) and build the library. The debug info would then contain references to S:\SuperLibrary instead of C:\Projects\Useful\Shared\SuperLibrary
Now the other developers, can do exactly the same, except that their maps would make S: correspond to another folder share in their own machines, wherever they have copied the sources.
However, I seem to recall this solution does not work if you aren't actually conected to some network.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
That's what I remembered too, but when I tried it, it didn't do anything - it simply skipped over the function I told it to step into. Perhaps I was doing something else wrong; I'll poke into that some more.
The second solution would be a good one, except the API will be exposed to a larger and more general audience - i.e., anyone can download the library and write plugins with it.
Thanks for your suggestions though.
[Insert witty and relevant signature here]
|
|
|
|
|
Mr. Accident wrote:
That's what I remembered too, but when I tried it, it didn't do anything - it simply skipped over the function I told it to step into. Perhaps I was doing something else wrong; I'll poke into that some more.
How are you generating the debug info? If you are generating a PDB file you need to distribute the PDB file too.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Argh, it's times like these that I feel really silly.
I had the PDB for the main parent application, but I was completely forgetting the PDB for the class library. Not only, that, but I had been specifying the incorrect version of the DLL in the debug settings! That would certainly explain why the debugger didn't bother asking me where the code was.
Thanks very much for your help.
[Insert witty and relevant signature here]
|
|
|
|
|
Hi,
I am doing a project in win32. Sometimes in XP, even after I close the app the process sits there ie. I could see my exe still up in the task manager.
So I want call this ExitProcess() function to force the exe to close.
What parameter should I give to this function. What is the difference between ExitProcess(0) and ExitProcess(1).
Plz someone help.
|
|
|
|
|
The difference is only the exit code, think of it as a returned value similar to a function returning a result. Traditionally 0 means no error occured, -1 might have special meaning, numbers above 0 are other more common errors. If you don't intend to use exit codes in a useful sense, just use 0.
|
|
|
|
|
|
Ann66 wrote:
I am doing a project in win32. Sometimes in XP, even after I close the app the process sits there ie. I could see my exe still up in the task manager.
ExitProces..... Why don't you use WM_QUIT message to close you application....
Ann66 wrote:
I could see my exe still up in the task manager.
Intresting... are you running any loop or you forget to free any com object..... could you tell me what exactly your application doing...
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
A while back i saw a program that was able to capture an image of the entire workspace, i think by utilizing the Print_screen key on the keyboard some how!
I would like to know, how would you go about doing that with c++, and saving that image into a file?
thankz.
|
|
|
|
|
i seem to get this warning on damn near any MFC project i've used on Visual Studio .net
LINK : warning LNK4089: all references to 'OLEAUT32.dll' discarded by /OPT:REF
i looked it up and apparently the linker is decided that i dont need OLEAUT32.dll cause nothing is using it.. but i cant figure out where in the world any part of my project is mentioning OLEAUT32.dll in the first place. so im not sure why the linker thinks i wanted it in the first place
|
|
|
|
|
With many include files, they have a #pragma statement that adds the DLL/LIB as a required DLL/LIB during the link phase.
For example, COMDEF.H includes:
#pragma comment(lib, "oleaut32.lib")
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
This warning is harmless, and can be ignored if the DLL in question is one of the system DLL's. In that case, a piece of library code (which may have been omitted due to function-level linking) referenced the DLL, and you no longer need it. If the DLL in the message is one of yours, you may want to check.
Software Zen: delete this;
|
|
|
|
|
I am having trouble overiding the default tooltip text that display the tick count in a slider control.
My code is below. Any suggestion is greatly appreciated.
void CGraphView::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
static CString strMinutes;
CToolTipCtrl *pTool;
if ((CSliderCtrl*)pScrollBar == &m_Slide &&
(nSBCode == SB_THUMBPOSITION || nSBCode == SB_THUMBTRACK)
)
{
pTool = m_Slide.GetToolTips();
strMinutes = "Test";
pTool->UpdateTipText(strMinutes, this);
pTool->Update();
}
CFormView::OnHScroll(nSBCode, nPos, pScrollBar);
}
Anil
|
|
|
|
|
How can I read each cell from each row in a worksheet. Can some one help me . I have tried it out. I can search a particular string. Also can some1 plz give me a good link for tutorial on it or any other reference
Regards
|
|
|
|
|
Hello All.
I'm a beginner programmer and try to make a simple web browser using C++/MFC. With the help of this site, I managed to started it. I'd like to do the control on VIEW menu (Text Size) to be changed same as in IE. I don't know how can I do it. I'd like to ask some help for the people out there. Please teach/tell me how can I start to do it.
Any help will be much appreciated.
Thanks and more power to this site.
With great power comes a great responsibility.
|
|
|
|
|
babyspidy wrote:
I'm a beginner programmer and try to make a simple web browser using C++/MFC.
So have you see the CHtmlView class?
babyspidy wrote:
I'd like to do the control on VIEW menu (Text Size) to be changed same as in IE.
I'm not exactly sure what this means?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Thanks for the reply.
I have seen the CHtmlView class but not quite familiar how it works.
For the View menu found in IE menubar, there's a Text Size option which you can select Largest, Large, Medium, Small, and Smallest for the user to increase/decrease the text size. I want to do this function in my project but I don't know how I will put a function on it.
In my ****View.cpp, I put
ON_COMMAND(IDR_VIEW_LARGEST, .....)
ON_COMMAND(IDR_VIEW_LARGE, .....)
ON_COMMAND(IDR_VIEW_MEDIUM, .....)
ON_COMMAND(IDR_VIEW_SMALL, .....)
ON_COMMAND(IDR_VIEW_SMALLEST, .....)
...
but I don't know how I will implement the function for it. I hope someone knows how to handle those commands..
Thanks again and best regards.
With great power comes a great responsibility
|
|
|
|
|
If you are using CHtmlView, to obtain the current setting, try this:
VARIANT var;
ExecWB(OLECMDID_ZOOM, OLECMDEXECOPT_DONTPROMPTUSER, NULL, &var);
To set a given size, try this:
VARIANT var;
var.vt = VT_I4;
var.lVal = 1;
ExecWB(OLECMDID_ZOOM, OLECMDEXECOPT_DONTPROMPTUSER, &var, NULL);
Hope that helps,
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|