|
You have to "Add Method" to add exported like function, It seems that you just add member function to the class only. Try right clicking IDispatch interface ( can identify with an image 'o-0' before the class name) and use "Add Method" to add a functon, which will be available in test container.
|
|
|
|
|
OK, it works!
But there's still one question: when I compile the project, I get an .ocx file. I want to implement this funciton for a SOAP-Server. The generator need a .dll file. Can I simply change the extension?
|
|
|
|
|
Hello all,
I have created an SDI application with multiple document templates. When I click new file I get the option of which document type to create, which is nice. However if I create a document of a different type the current document then a new frame gets opened and I end up with one frame for each document type. I was hoping to get just the one frame, and to be able to switch the document type. Any suggestions as to how I can achieve this?
Cheers,
Mark
|
|
|
|
|
anyone?
Thought I'd try killing the old frame when the new one opened to appear as if it was the same frame. Unfortunately the first frame is the main application window, so when that is closed the whole application closes - bye bye new window too. Hmmm
I'm really surprised that this doesn't seem possible!
Mark
|
|
|
|
|
I have written a simple 3rd party Administration DLL for the RRAS service running on Win 2000. All works fine, the RRAS service starts and my exported functions are called by RRAS.
When I move to Windows server 2003 I cannot get the RRAS service to start - I get error 0x126 (module cannot be found) As far as I can tell, the Admin Dll functions required to be exported in Win 2003 are the same as win 2000, so I am now banging my head against the wall. Help!!
Have trawled through MSDN to no avail. I suspect I may be doing something daft - but who knows?
Dave T. Leeds UK
|
|
|
|
|
I am using the following code in order to start an MFC Win application from another MFC win application that is currently running:
int CTransfer::StartNewProcess(CString szNewProcess)
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
char szProcess[128];
szNewProcess += ".exe";
strcpy(szProcess , (LPCTSTR)szNewProcess);
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
// Start the child process.
if( !CreateProcess( NULL, // No module name (use command line).
szProcess, // Command line.
NULL, // Process handle not inheritable.
NULL, // Thread handle not inheritable.
TRUE, // Set handle inheritance to FALSE.
NORMAL_PRIORITY_CLASS, // No creation flags.
NULL, // Use parent's environment block.
NULL, // Use parent's starting directory.
&si, // Pointer to STARTUPINFO structure.
&pi ) // Pointer to PROCESS_INFORMATION structure.
)
{
return 1;
}
// Wait until child process exits.
WaitForSingleObject( pi.hProcess, INFINITE );
// Close process and thread handles.
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
return 0;
}
The idea is that while the called window (modal) will be open the caller/creator will wait inactive until the user exits. This code will work with no issue under Win2000 and VS 2003. When I converted the projects to VS 2005 and I run them under Win 2003 I have the following strange bahaviour. The new window will show up but after a few seconds the caller will start processing/doing something because the mouse cursor will change to an hourglass. In addition to that in the Task Manager I can see two instances of the caller. So when I do Goto Process for each one of them, one will point to the caller.exe and the second one will point to the explorer.exe. I even created two new projects, because I thought that the conversion of the projects from 2003 to 2005 had the problem, but the bahviour is the same. If you have any idea / suggestion please let me know. Thank you in advance for your time.
Spiros Prantalos
Miami the place to be!!
|
|
|
|
|
Why are you using szProcess and strcpy() ? They are completely unnecessary. Just pass szNewProcess directly to CreateProcess() .
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
You are getting a "ghost" of the app. The system will create a dummy window that mimics the original when the original stops processing. Not sure why they did this, but thats the second window you're seeing. It won't actually do anything. Your best bet is to reengineer it so that you don't block in the original app while waiting for the second to close. Maybe disable the application window and start a thread that waits for the second app to finish, then enable everything again.
|
|
|
|
|
hi..
i need a sample program for sending and receiving messages or data using udp. if anybody have sample program plz send the link. except the msdn..
yamuna
|
|
|
|
|
( using VS.net 2003, on Win2000 )
in MSDN, SetParaFormat can take either a PARAFORMAT or a PARAFORMAT2 structure.
how can I tell the compiler to use the version that takes a PARAFORMAT2 ?
now, when compiling it tells me that it cannot convert PARAFORMAT2 to PARAFORMAT ...
'DWORD CRichEditCtrl::GetParaFormat(PARAFORMAT &) const' : cannot convert parameter 1 from 'PARAFORMAT2 *__w64 ' to 'PARAFORMAT &'
This is what I'm doing
PARAFORMAT2 pf;
ZeroMemory( &pf, sizeof ( PARAFORMAT2 ) );
pf.cbSize = sizeof(pf);
pf.dwMask = PFM_ALIGNMENT|PFM_BORDER;
pf.wAlignment = PFA_CENTER;
pf.wBorderWidth = 5000;
m_RichEdit.SetParaFormat(&pf );
Thanks.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Use
m_RichEdit.SetParaFormat(pf); (No ampersand before pf)
- Dy
|
|
|
|
|
oh crap, it's a reference !!
it also works with
m_RichEdit.SendMessage( EM_SETPARAFORMAT, 0, (LPARAM) &pf );
thanks!
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
You have the answer to your problem, but not an answer to your question - the size of the structure tells the control what version it is. So if you set cbSize to sizeof( PARAFORMAT ) , and then call SetParaFormat(...) , the PARAFORMAT2 -specific things will be ignored.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
I have to supplement our message window in our application; right now, it's an owner drawn control from dundas, which is enough for simple one line message ( fonts, colors, ... ) and easilly modifiable to add support for icons.
But now I have to be able to do more complex things, mainly tables.
I want to use HTML ( with gary wheeler's webbrowser control ) but while it's working, it prooves to be hard to make it work like a message window; for example scroll to bottom each time a new message is added, I need to regenered the whole HTML and re-load it and then scroll back down ... which flickers the control ( scroll up when reloading, scroll down ).
Is it possible to use RTF to generate simple table formatting ? I looked at what Word generates for a simple table, and it's unreadable ... so that's probably a no-no ...
Are there any other technology that I could use ?
Thanks.
Max.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Well, if you use the standard IE control, you can append to it by manipulating its document object (I think), so you do not have to worry about reloading and re-rendering the entire log/message.
Just a thought...
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Hi,
Can anyone suggest some website or an article posted here, which gives some introduction:
1) how to Manage loading of Menus, Toolbars, Bitmaps etc.,
2) How MFC loads all these and especially when a Context menu is loaded.
i see in many places, where, there is a function call to load an image and immediately it is detached.
If someone can post an article on that, i would be grateful.
thnx,
KAB
|
|
|
|
|
Is there any tool for finding the Resource leaks ?
|
|
|
|
|
|
I am maintaing an application with mixed code. Some is C++ and follows the OO paradigm some it dates back 1980 and follows the standard C style. I am trying to get function references from member functions to assign them into old fashion function pointers. If I can do I may have a listeners pattern in the old code. I tried a small example like
<br />
#include <afx.h><br />
#include <stdio.h><br />
<br />
typedef int TBK_BOOL;<br />
<br />
#define TBK_TRUE 1<br />
#define TBK_FALSE 0<br />
<br />
typedef void (*TB_LISTENER_NOTIFICATION_FUNCTION)(<br />
TBK_BOOL value);<br />
<br />
class Listener<br />
{<br />
private:<br />
int identity;<br />
<br />
public:<br />
Listener() {identity = 0; };<br />
<br />
void setId(int id) { identity = id; };<br />
int getId(int id) { return identity;};<br />
<br />
void notify(TBK_BOOL note);<br />
};<br />
<br />
void Listener::notify(<br />
TBK_BOOL note)<br />
{<br />
if( note )<br />
printf("Object no %d was notified\n", this->identity);<br />
else<br />
printf("Object no %d was left asleep \n", this->identity);<br />
}<br />
<br />
int main(int argc, LPCSTR argv [])<br />
{<br />
Listener x;<br />
Listener y;<br />
<br />
TB_LISTENER_NOTIFICATION_FUNCTION lists[2];<br />
<br />
x.getId(1);<br />
y.getId(2);<br />
<br />
lists[0] = x.notify;
lists[1] = y.notify;
<br />
(lists[0])(TBK_FALSE);<br />
(lists[1])(TBK_TRUE);<br />
}<br />
And I received the following compilation errors
G:\func.cpp(45) : error C2440: '=' : cannot convert from 'void (__thiscall Listener::*)(int)' to 'void (__cdecl *)(int)'
There is no context in which this conversion is possible
G:\func.cpp(46) : error C2440: '=' : cannot convert from 'void (__thiscall Listener::*)(int)' to 'void (__cdecl *)(int)'
There is no context in which this conversion is possible
Is anyway that I can do what I am trying or should I abandon the idea of referencing object functions outside of it??
|
|
|
|
|
as notify() is a member of a class, then it implicitely receives the this pointer as a parameter...
to solve this, declare it like this :
static void notify(TBK_BOOL note);
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VCalc 3.0 soon...]
|
|
|
|
|
You can't (as you've seen) assign a pointer to a member function to a normal function pointer. A pointer to a member function would look like this:
typedef void (Listener::*)(TBK_BOOL note) NEW_LISTENER_NOTIFICATION_FUNCTION;
To call this pointer you would need more information then with a normal function pointer, you need to supply the this pointer. A call could look like this:
Listener x;<br />
NEW_LISTENER_NOTIFICATION_FUNCTION pFunc = &Listener::notify;<br />
(x.*pFunc)(Some_Value);
The functionality you're after seems more like a delegate then a C++ style member pointer. I believe there is an article on the code project which provides such delegates - but these can only be used from C++.
Steve
|
|
|
|
|
|
It doesn't modify the class but it does access a member variable. I assumed that in the real implementation the function would be more elaborate.
Steve
|
|
|
|
|
|
Hi
I have a dialog based MFC application in which I want to handle an event which occurs when user presses Ctrl+Alt+Del and from Windows Security dialog it select "Lock Computer" button and it locks the computer.
I want to know which event occurs and how to trap this event?
Any help would be strongly appreciated.
Mahesh
|
|
|
|