|
Hello,
I am creating a dll in which I simply want to export a class.
When creating the dll I noticed in the .cpp file that is default created by VC and which has the InitInstance inside, the following comment:
// Note!
//
// If this DLL is dynamically linked against the MFC
// DLLs, any functions exported from this DLL which
// call into MFC must have the AFX_MANAGE_STATE macro
// added at the very beginning of the function.
// ......
etc...
Does that mean that in each member function of the class which I want to export I`ll need to add that macro?
Why isn^t it present in the default InitInstance function?
And what`s the use of that InitInstance function anyway? I created the dll and debugged it and put a breakpoint in tthe InitInstance function, but it was never called. The theApp object of the dll was never instantiated either, but none the less I used an exported class from that dll in another app.
Thx for any help you might give.
Friendly regards,
Davy
|
|
|
|
|
GDavy wrote:
Does that mean that in each member function of the class which I want to export I`ll need to add that macro?
The AFX_MANAGE_STATE() macro is needed because MFC will use resource templates from the main/owning application by default. If your exported function needs a resource in the DLL, you need to switch the module state for the correct resource template to be used.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I have written a callback function in a DLL written in VC++ to call back to an application written in VB, everything works fine in debug build, but when i build the executable in VB it crashes when the program tries to call a fuction to the DLL while still in the callback function from the DLL
The vb is as :
Public Sub cbFunction(ByVal nEvent As Long, ByVal sData As String)
the address of the function is passed to the dll as :
NRInitialise(AddressOf cbFunction)
I need to be able to call the dll whilst in the call back function...
Any ideas ???
Cheers
|
|
|
|
|
Hi,
Can anybody help me out here.
In one of my project, i need to send data from array to Excel Sheet.
Or from a List Control to ExcelSheet.
Thank.
neelima
|
|
|
|
|
Are you using Excel Automation?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hello
char array[5] = {'H','E','L','L','O'};<br />
this->textBox1->Text = array;
(This works, even without appending '\0' at the end)
Is there a way to display integers directly, without first convert them to strings.(So far I used the sprintf function)
t.
|
|
|
|
|
doneirik wrote:
Is there a way to display integers directly
not unless the control has a specific method for displaying integers. most only have methods to display strings.
Image Toolkits | Image Processing | Cleek
|
|
|
|
|
I have an MFC extension DLL (uses MFC dynamically) and I use it from my MFC exe (uses MFC dynamically). I have a class that derives from one of the classes defined in the extension DLL.
Unfortunately I keep getting this linker error ;-(
MyClass.obj : error LNK2001: unresolved external symbol "protected: static struct AFX_MSGMAP const CMyClass::messageMap" (?messageMap@CMyClass@@1UAFX_MSGMAP@@B)
Anyone knows what's causing this?
Nish
p.s. I did a fair bit of googling but none of the search results solved the issue ;-(
|
|
|
|
|
|
hi,
i want to make an add-in to visual studio
that will have a menu and each choice of the menu will do something.
like pressing on "Tools" (for example) -> then comes the menu and then pressing one of the commands.
the problem is that i don't know how to do the add-in as menu.
i tried all the wizards and samples but didn't find one.
(its alot diffrent from doing Add-In to visual studio 6)
does anyone can direct me to a source or tell me some hints on this subject?
thanks in advance,
Avi.
|
|
|
|
|
Hi,
I get this runtime error
Unhandled exception at 0x7c59bbf3 in NewMumsEngine.exe: Microsoft C++ exception: std::out_of_range @ 0x016c605c.
when I try to execute this line
sVarData = m_pElement[iPos].sValue.substr(iIndex+1);
where
sVarData is of string type.
m_pElement[iPos] is an object of a structure
sValue is another string variable in the same structure.
Can anyone please explain this error to me and tell me how to remove it.Any suggestions please?
thanks,
Arjun.
|
|
|
|
|
First guess - the error is 'out of range', so is iIndex + 1 greater than the size of sValue, or is iPos greater than or equal to the number of elements ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Asking the same question again doesn't change the answer.
|
|
|
|
|
Hello,
How can i disable minimised, maximized and restore button
of my window. My requirement is to keep window and dialogBox
always in maximized position. And do not let user change its
size.
|
|
|
|
|
in the resource editor, specify the related dialog property... (right click the dialog title bar - for example - > Properties > check the right check box....)
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
You have to uncheck the 'System Menu' checkbox in the properties of your dialog (in the 'styles' tab).
If you use the MFC framework and if you have a SDI application, to remove these buttons on the main window, you need to add these lines at the end of InitInstance (from your App class):
m_pMainWnd->ModifyStyle(WS_SYSMENU, NULL);<br />
m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED);<br />
|
|
|
|
|
Hi,
I want to extract text content of MS-OFFICE documents(PPT,XLS....), programmatically.
THanks
MJValan
|
|
|
|
|
If requiring Office to be installed on target PC is OK, check COM.
Otherwise there are 3rd party suppliers for libraries reading various formats. Search for "xls text conversion" etc.
I can recommend wordcnv.com[^] for Word conversion, I have used it without problems.
Igor Green
http://www.grigsoft.com
Compare It! + Synchronize It! : Files and folders comparison never was easier!
|
|
|
|
|
|
|
Here is what I've coded for the task
case WM_MOVING:
{
LPRECT lprc = (LPRECT)lParam;
RECT WD;
GetWindowRect(hwndDlg,&WD);
WD.right -= WD.left;
WD.bottom -= WD.top;
RECT VDR;
SystemParametersInfo(SPI_GETWORKAREA,0,&VDR,0);
if(lprc->left <= VDR.left + 5 &&
lprc->left >= VDR.left - 5)
{
lprc->left = VDR.left;
lprc->right = lprc->left + WD.right;
}
if(lprc->top <= VDR.top + 5 &&
lprc->top >= VDR.top - 5)
{
lprc->top = VDR.top;
lprc->bottom = lprc->top + WD.bottom;
}
if(lprc->right >= VDR.right - 5 &&
lprc->right <= VDR.right + 5)
{
lprc->right = VDR.right;
lprc->left = lprc->right - WD.right;
}
if(lprc->bottom >= VDR.bottom - 5 &&
lprc->bottom <= VDR.bottom + 5)
{
lprc->bottom = VDR.bottom;
lprc->top = lprc->bottom - WD.bottom;
}
int HalfHeight = ((VDR.bottom - VDR.top) / 2) - (WD.bottom / 2);
int HalfWidth = ((VDR.right - VDR.left) / 2) - (WD.right / 2 );
if ((lprc->top >= HalfHeight - 5 && lprc->top <= HalfHeight) ||
(lprc->top <= HalfHeight + 5 && lprc->top >= HalfHeight))
{
lprc->top = HalfHeight;
lprc->bottom = lprc->top + WD.bottom;
}
if ((lprc->left >= HalfWidth - 5 && lprc->left <= HalfWidth) ||
(lprc->left <= HalfWidth + 5 && lprc->left >= HalfWidth))
{
lprc->left = HalfWidth;
lprc->right = lprc->left + WD.right;
}
return TRUE;
} break;
The only problem is after it's been snapped, when you move the mouse slowly away from the edge the window will stay put! Why does it do that?
I want it to mimic DVD Decrypter
Thank you.
|
|
|
|
|
The problem is that if the mouse moves slowly, you'll put it back where it was so that the user keeps having to drag it from the same spot. If they don't move enough, you'll keep snapping it back to where it was.
I think the easiest way (and I'm happy for someone to correct this) is to keep track of where the window and mouse cursor were when the operation was initiated (handle the WM_ENTERSIZEMOVE message) and calculate the full window position each time, rather than using the rectangle that was provided to you in the WM_MOVING message. Something like this:
In WM_ENTERSIZEMOVE:
- Get the window rectangle (GetWindowRect() ) - I'll call it oldWindowPos
- Get the mouse cursor position (GetMessagePos() ) - I'll call it oldCursorPos
In WM_MOVING:
- Get the current cursor position (GetMessagePos() ) - I'll call it newCursorPos
- newWindowPos.left = newCursorPos.x + (oldWindowPos.left - oldCursorPos.x)
- newWindowPos.right = newCursorPos.x + (oldWindowPos.right - oldCursorPos.x)
- newWindowPos.top = newCursorPos.y + (oldWindowPos.top - oldCursorPos.y)
- newWindowPos.bottom = newCursorPos.y + (oldWindowPos.bottom - oldCursorPos.y)
[edit]Forgot to mention that after this, you'd snap the window position [/edit]
Something like that, anyway
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
|
The office documents are OLE Compound Documents. You'll need to use the IPropertyStorage interface.
If you search for IPropertyStorage on Google and MSDN, you should find some examples.
Michael
CP Blog [^] Development Blog [^]
|
|
|
|
|