|
It looks like you can make a key under HKEY_CLASSES_ROOT\Applications with your DLL's name, then below that create a shell\open\command subkey whose default value is the command-line to run.
IE (iexplore.exe), Firefox (firefox.exe) and Visual Studio (devenv.exe) all seem to do this, for example.
Below the filetypes themselves there's just an OpenWithList key which has empty sub-keys with the EXE/DLL names which correspond to the Applications sub-keys mentioned above.
Hope that helps!
|
|
|
|
|
I've got a Win32 (no MFC, ATL etc.) DLL project which I recently moved from VS2003 to VS2005.
Of course, the first step was to take care of the compilation errors/warnings, mainly due to deprecated functions and the new "secure CRT", which I simply #defined away for now because much of the code is 3rd party graphics libraries I don't want to extensively modify. The code now compiles fine with no errors and no warnings.
The problem is that when I run my DLL it crashes in apparently random places and in different parts of the project which have very little in common. For example, I had a crash within a dialog's window procedure and another similar crash inside library code (also compiled by me in VS2005) which loads an image.
In the dialog proc's case I was able to "fix" the bug by refactoring my huge dlgproc into several smaller functions. (I could also "fix" it by commenting out the lines where the crash occurred but it's interesting to note that the crash still happened if I changed those lines to send a WM_NULL to the dialog.) The dialog crashes were occuring around the time of recursive calls to the dlgproc, and under a debugger the crash in both the dialog and the image library were generating a "stack overflow" message. But I don't buy this as the real cause because there are very few functions and very little data on the stack and the code is not in an infinite loop, worked fine under VS2003 and indeed works if I refactor the code in a way which ads *more* call data to the stack, not less. The recursion level is 3 calls deep, if that.
I sent the code to a friend who has BoundsChecker and he said it couldn't detect anything wrong with it, but he could still reproduce the crash.
This has been driving me nuts and wasted a lot of my holiday time that I wanted to spend actually making cool stuff. I wonder if anyone has experienced anything similar and has suggestions on where to look? It feels like a compiler error or a stack corruption issue rather than a genuine stack overflow.
Has anything changed in the way VS2005 deals with the stack? I haven't touched any project settings after converting from the VS2003 project, but I read that the default stack size has been increased from 64k to 1meg. Maybe there's a problem when DLLs are called from non-VS2005 programs and the VS2005-generated code is assume 1meg of stack has already been reserved or something? I'm clutching at straws really... (Writing a test harness for the DLL in VS2005 is on my list of things to try but that list is long, my holiday is over, and the whole ordeal has left me quite frustrated! So I'm hoping someone has some good advise.)
Thanks for reading and any help!
|
|
|
|
|
I would suspect heap corruption. Try enabling the page heap. How to do this:
1. Download WinDBG from Microsoft here[^].
2. Install it.
3. Select "Start Menu->Programs->Debugging Tools for Windows->Global Flags".
4. Select the "Verifier" tab.
5. Enter the name of your EXE in the "image" edit box and press TAB. e.g. "Notepad.exe".
6. Tick "Enable" & "PageHeap".
7. Press "OK"
Run you application. It will run many times slower then normal and consume much more memory. In some cases I have been unable to run a particular application as my machine didn't have enough memory; you may need a beefy machine for this kind of debugging.
Don't forget to turn off the page heap when done. To do this enter the EXE name, remove the options we added and press OK. Let me know if you have any questions along the way.
Steve
|
|
|
|
|
Thanks Steve, it's definitely worth a try!
|
|
|
|
|
HI,
I want to create a Windows service that runs at the windows startup and invisible from the user , and perform the functionalty of Listening on a given Socket.
How can I create it ?
Thanks
Regards.
|
|
|
|
|
zahid_ash wrote: I want to create a Windows service that runs at the windows startup and invisible from the user
Create a new ATL Project. In the Project Wizard under Application Settings/server type, choose "Service (EXE)".
zahid_ash wrote: perform the functionalty of Listening on a given Socket.
Sockets.com[^]
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
Could you please give me link or code snip which explains the development of "new ATL Project. In the Project Wizard under Application Settings/server type, choose "Service (EXE)"."
Thanks again
Regards.
|
|
|
|
|
|
Hi All,
how can I get information regarding scrollbar needed or not. i need to show scrollbar only if there are more items to scroll. how we can implement this in a owner drawn listbox?
Currently I am working as software engineer at Network System Technologies Pvt. Ltd (NeST). Most of my project are in C++. Most interesting are is GUI programming.
|
|
|
|
|
If you are using CWnd as parent I think that you could use:
SCROLLINFO Info;
GetScrollInfo(SB_VERT,&Info);
//Some corrections like:
Info.nPos=0;
Info.nPage=Info.nMax;
Info.fMask|=SIF_DISABLENOSCROLL; //Don't hide the scrollbar (but it will be disabled)
//Else the scrollbar will deleted
SetScrollInfo(SB_HORZ,&Info);
|
|
|
|
|
try this
CRect clRect;
m_ListEx.GetClientRect(clRect);
int nFitCount = clRect.Height() / m_ListEx.GetItemHeight(0);
if( nFitCount < GetItemCount())
{
// scrollbar needed
}
nave
|
|
|
|
|
Dear Naveen,
thanks for ur reply. but unfortunately, the items in my listbox are having different heghts.
so how can I calculate from from single one?
|
|
|
|
|
in that case try this
int nTop = m_List.GetTopIndex();
CRect ClientRect;
m_List.GetClientRect( &ClientRect );
BOOL bOutSide;
int nBottomitem = m_List.ItemFromPoint( CPoint( ClientRect.left,ClientRect.bottom), bOutSide );
if( FALSE == bOutSide )
{
int nCount = m_List.GetCount();
if( nCount > ( nBottomitem - nTop ))
{
// Scrollbar needed
}
}
nave
|
|
|
|
|
Hi
I am wondering how you can square a value in C++. I want to work out the square of a number that the user inputs but I dont know how you would type in the command so that the computer will square this number. What is the command for squared? Please help.
Thank You.
linda
|
|
|
|
|
Build it by yourself:
#define SQR(x) ((x)*(x))
and/or
double sqr(double const& x){<br />
return SQR(x);<br />
}
-- modified at 9:32 Monday 15th May, 2006
|
|
|
|
|
pow
Calculates x raised to the power of y.
#include <math.h>
#include <stdio.h>
void main( void )
{
double x = 9.0, y = 2.0, z;
z = pow( x, y );
printf( "%.1f to the power of %.1f is %.1f\n", x, y, z );
}
9 to the power of 2 is 81
----------
There go my people. I must find out where they are going so I can lead them.
- Alexander Ledru-Rollin
|
|
|
|
|
Hi everyone
thanks a bunch for all your help here.
I did want the value to be squared, not power to, it is the opposite of what pow does (if pow is to the power of - seeing it starts with Pow for Power). I was after the square - you know the square button on your calculator. So the square root.
Thanks
linda
|
|
|
|
|
In English, the Square of a number is the number raised to the power of two (or, multiplied by itself).
The Square Root of a number is "that number or quantity which, multiplied by itself, produces the given number."
sqrt
Calculates the square root.
double sqrt( double x );
Example
/* SQRT.C: This program calculates a square root. */
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
void main( void )
{
double question = 45.35, answer;
answer = sqrt( question );
if( question < 0 )
printf( "Error: sqrt returns %.2f\n, answer" );
else
printf( "The square root of %.2f is %.2f\n", question, answer );
}
Output
The square root of 45.35 is 6.73
----------
There go my people. I must find out where they are going so I can lead them.
- Alexander Ledru-Rollin
|
|
|
|
|
The best way is just to multiply it by itself. Using pow is fine but not as efficient as simply multiplying the number by itself as it’s more general. Defining a macro is not a good idea (I can hear the screams of people objecting already): prefer inline functions to macros. There are many reasons for this, including:
- Macros are hard to debug. For example try stepping into a macro.
- Macros don't respect the C++ language rules. For example you can't put them into namespaces or use function overloading.
- Macros can have side effects which are very hard to identify and debug.
Macros have their place but most C++ programmers overuse them.
Steve
|
|
|
|
|
Than you for the great lesson :
I can add olso that they could be coded into a slower code:
(see my prev post and...)
SQR(3+5*7-6+sqr(5.9))
will be, unfortunatly , coded into
( 3+5*7-6+sqr(5.9)) ) * ( 3+5*7-6+sqr(5.9)) )
and we can say goodbye to the powerfull C++!
(Sorry, but nobody will read this post! )
|
|
|
|
|
simple Linda
you do this
double squared(double dNumberIn)
{
return dNumberIn *= dNumberIn;
}
all the best Alton
|
|
|
|
|
Hi all,
if i use this code in my derived CWndEx class:
BOOL CWndEx::PreTranslateMessage(MSG* pMsg)
{
if( IsDialogMessage( pMsg ) )
return TRUE;
else
return CWnd::PreTranslateMessage( pMsg );
}
then standing on a button in my CWndEx and pressing Tab key move me to the other controls in my CWndEx class. i have a child dialog in my CWndEx class and hiting the tab also step in the dialog's control. trouble is pressing the tab within the dialog will never get me back to the controls in CWndEx?
in more simple words : i can step into the dialog using the tab, but i can't step out of it using the tab , it keeps looping the controls inside the child dialog
any suggestions?
Yaron
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
YaronNir wrote: in more simple words : i can step into the dialog using the tab, but i can't step out of it using the tab , it keeps looping the controls inside the child dialog
because once i enter the Dialog, Window start treating it as Dialog message!, there fore you seeing that behaviour!
"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 guys,
I would like to know how can I connect my application to a mdb file.
I just wrote some others classes for this project. And the others are all in pure c++.
How can I do that?
tnx
|
|
|
|
|
Try ADO .
Make use the msado15.dll. It has a bunch of COM interfaces that serves all your DB needs.
#import "c:\Program Files\Common Files\System\ADO\msado15.dll"
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
[My Current Status]
|
|
|
|