|
Augment the dialog constructor with an additional CCIntSocket * parameter. Depending on what part (the dialog or the code using it) takes responsibility for the cleanup of this CCIntSocket * , you'll delete it in one place or the other.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks ! but it is already done
In fact, when I "start" the modeless dialog by :
AfxBeginThread( RUNTIME_CLASS(CMyDlgThread) )
there's no way I can pass parameters...
Am I missing something ?
|
|
|
|
|
Ummm... So, you're launching a separate thread to maintain that modeless dialog of yours, right? If so, then you can use the CREATE_SUSPEND flag when creating the thread, pass the socket pointer to some member variable in CMyDlgThread designed to that purpose and then call CWinThread::ResumeThread to start the actual execution of the dialog.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
The trick works ! Thank you !
Unfortunately I get an assertion failure on "sockcore.cpp", maybe a socket cannot be reused in another thread ?
Any idea ?
|
|
|
|
|
If you could post the actual assertion and the context where is signaled, maybe we'd be avle to figure out ehat's going wrong.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
You'll note that I achieved this successfully the other day. I came across all sorts of problems:
It seems that when you create a socket, various message maps and macros and stuff are set up internally. When these fire off, all sorts of odd stuff happens.
What you need to do it this:
1. Detach() your socket to get a SOCKET handle
2. Start your (User Interface type) thread, with THREAD_SUSPENDED
3. Tell you UI Thread object what the SOCKET handle is. ie, use a public member variable.
4. Resume your thread.
5. In your threads init function, create a new CYourSocket object, and Attach() it to the socket handle.
that worked for me.
jon
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
In fact I forgot to do the Detach/Attach procedure...
Now everything is working fine !
Thanks for your help !
|
|
|
|
|
Wow, second time you've answered that in as many days!
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Yeah, I'm the CREATE_SUSPEND man
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I'm writing a complex C program with VC++ 6.0. This program is very low-level (OS-like), and will actually run on a non-PC device. So the program itself must be in portable C and cannot use any Windows-specific features or APIs. I’m doing primary development and simulation with VC++/Windows because it is a much more convenient IDE than what is available for the native machine.
Examining the program's state with the standard VC++ debugging features (local/global variables, memory window) is proving to be very tedious. I need some aids to help me display (and hopefully modify) the program-specific state in a more human-readable format.
I've been trying to learn about all the VC++ features that I never knew existed. It seems that some combination of Visual Basic Macros, Debugger Add-ins, and/or Visual Studio Automation Interface might be able to help me. But I need some advice from those who know more about these facilities.
The kinds of things I need to display are the program’s private internal:
- Heaps
- Stacks
- Data structures
- Object references
- Object contents
- Memory maps
- Configuration data
- Trace buffers
Initially, I would be happy with some simple display-only capability, such as just writing text to the console or debug output window. While I could do this with internal printf and trace statements, I’d prefer to do it “on demand”, for example, by invoking a VC++ Debugger VB macro.
Ideally, what I want is to be able to add some menu items and/or icons to the Debugger Toolbar. Selecting these items will launch custom code (written by me) which will display in a nicely formatted way my program's custom internal state. The next step beyond that is to display groups of items in their own custom Debugger GUI windows, and allow me to modify program data in those windows.
I realize that this is a lot of work, and amounts to writing pieces of my own custom symbolic debugger. But it might be worth it to me in the long run, especially when I realize that Visual Studio seems to be designed to support this kind of thing.
So ... I’d appreciate it if someone can point me to:
- Architectural documents
- "How to" documents
- API reference documents
- Sample code
that will help me in my quest.
Thanks a bunch!
Mitch Butler
|
|
|
|
|
|
Hello,
i have a problem that bugs me for weeks now. And the question is very simple: how can i obtain the tooltip text from any tooltip? (for example - tooltip text from the items in the taskbar (system tray) - like from icq )...
I'm really stuck here
Please, does anyone have any kind of advice, code snippet, kind word ...
Thank you in advance.
Best regards,
dejan
|
|
|
|
|
You'll need to check for the window's class (use GetClassName) to see if the window in question is a tooltip. A tooltip has a class of TOOLTIPS_CLASS.
As far as retreiving the text of the tooltip, look into TTM_GETTEXT message and use the SendMessage API with it. You "might" be able to use GetWindowText also, but that's just a guess because I've never tried it.
If you want a code sample, let me know.
Jeremy L. Falcon
"The One Who Said, 'The One Who Said...'"
|
|
|
|
|
Mr. Falcon thank you very much for your quick answer,
This is the part of code i use:
::GetClassName(hwnd, ClassName, 200);
if(strcmp(ClassName,"tooltips_class32") == 0) {
vidljiv = IsWindowVisible(hwnd);
if (vidljiv){
// nasoTool = SendMessage(hwnd, TTM_GETCURRENTTOOL, 0,(LPARAM) (LPTOOLINFO)&ti);
// if (nasoTool)
// ::MessageBox(NULL, ti.lpszText,"TOOLTIP INFO", MB_OK);
::GetWindowText(hwnd,WindowCaption,100);
::MessageBox(NULL, WindowCaption,"TOOLTIP INFO", MB_OK);
}
}
commented parts are the second solution (instead of the last two lines - getWindowtText and MessageBox)
Unfortunately neither solution works. GetWindowText returns an empty string and SendMessage returns 0. A guy from microsoft replied that, i quote "However, pointers cross process using SendMessage won't work."...
So it seems that catching tooltip text is not possible?!?
If you have any idea what else could i try please be so kind and post a reply.
I would like to thank you again for your efforts.
Best regards,
Dejan
|
|
|
|
|
ok, i've found it.
SendMessage (hwnd, WM_GETTEXT,...) works if you need text from a window in another process.
Jeremy thanks for trying to help.
Regards,
dejan
|
|
|
|
|
Basicly I have a file which has tons of crap in it which is being parsed into a CObArray. I want this to be accessable from all of my different classes, but i dont want it to have to parse the file in each of my classes. All of the previous posts on globals say to make a .h and a .cpp and just declare the global variables in there, and then include these files in the classes that need to access the variables. But if I make a .h and .cpp that handle the parsing of the file and storing into the CObArray, then wont it do this in every class I include it in?
Basicly I just want to load the file when the program starts, and be able to access other certain global variables, including the CObArray that is parsed from the file, and what the current data path are, and other things that will need to be access throughout the program. The CObArray should be constant since it's information will not change in the program, but the data path will be changed in the options section.
I have been just reading the variables by doing the GetParent() thing, but that causes major assertion problems when I call a class from different classes for obvious reasons.
any help will be much appreciated
-dz
|
|
|
|
|
If I'm understanding your requirements, maybe the design pattern called singleton is what you're looking for. A singleton is special class that ensures that there is only one instance of it in the program. One of its most usual layouts is as follows:
class singleton
{
public:
static singleton * get_instance();
private:
singleton();
singleton * instance;
};
singleton * singleton::instance=0;
singleton * singleton::get_instance()
{
if(!singleton){
singleton = new singleton();
}
return singleton;
}
singleton::singleton()
{
} (Note that this implementation does not ever delete instance which could be a problem on some cases.)
If you turn your CObArray into a singleton then you're guaranteeing that the parsing is only done once (or never if nobody happens to call get_instance ) and provide centralized access to the information.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
The easies thing you could do would be to add CObArray as a member variable of your CWinApp class:
class CMyApp : public CWinApp
{
....
public:
CObArray MyObArray;
}
Then, from anywhere in your application, you can refer to this single MyObArray instance in the following fashion:
((CMyApp *) AfxGetApp())->MyObArray
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
I am trying to remove CColtrolBar boder
It seems like neither of statements below seems to work. What's the deal??
m_wndDialogBar.SetBorders(0,0,0,0);
m_wndDialogBar.SetBarStyle((m_wndDialogBar.GetBarStyle &
~(CBRS_BORDER_ANY|CBRS_BORDER_3D));
void CCoolDialogBar::OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp)
{
return;
}
|
|
|
|
|
HI!
I use ole drag and drop in my application.
It's working wel, except that I can't get through the OnDrop, when I release the Left button of the mouse.
Can anybody help me?
Are there any things to set up in the drop source?
PLEASE HELP ME.
|
|
|
|
|
Hello everyone,
I have a pretty basic question.. I have a MDI app and I receive WM_COPYDATA messages from another app.. My MainFrame class handles all my copydata messages and then puts the data into my CListView.. The problem is, the CListView has to be the "active view" in order to take the wm_copydata messages and insert them into the CListView.. Is there a way to insert data into the CListView with out the view being active? My MDI app has 2 html views and 1 list view.. if one of the html views are active MainFrame doesn't put the data into the CListView.
Thanks!
Rob
|
|
|
|
|
You need to get the mesages from the App, not from the mainframe, When you get the message you need to get the list of All documents, when you get the ListViewDoc you can get access to the ListView....;)
Best Regards
Carlos Antollini.
Sonork ID 100.10529 cantollini
APATHY ERROR: Don't bother striking any key. Application has reported a "Not My Fault" in module KRNL.EXE in line 0200:103F
|
|
|
|
|
|
Don't mention it...
Carlos Antollini.
Sonork ID 100.10529 cantollini
Beta. Software undergoes beta testing shortly before it's released. Beta is Latin for "still doesn't work."
|
|
|
|
|
I'm adding serialize suport for my application. However, the output file had no suffix (showed as "text" ,not "text.***"). How to fix this?
|
|
|
|