|
Hi,
Events are signaled by calling the Invoke method of an IDispatch interface supplied by container. The interface lives in the apartment of its own thread, which is also the one containing the control itself. To comply with the STA model, we can only safely call this interface's methods from the thread in which it was created. If the control wants to signal an event from a different thread it must Marshal the IDispatch interface into the IStream first and then UnMarshal it. And of course it must call CoInitialize() too.
To Marshal/UnMarshal interface pointers you can use my favorite functions: CoMarshalInterThreadInterfaceInStream(...) and CoGetInterfaceAndReleaseStream(...).
Regards,
Alex Gorev,
Dundas Software.
|
|
|
|
|
I'm using Visual C++ 6.0
In the dialog editor I created some form_views (used as property pages) and set their font size to 10 at design time.
After I added the pages to a modeless property sheet /CMyView::OnInitialUpdate()/ the pages appeared using font size 8 though. (8 is the system default)
Where did I make the mistake? How could I change the property sheet's and pages' font to bigger?
I also tried to use the following in the property pages' OnInitDialog():
SendMessageToDescendants( WM_SETFONT, UINT(HFONT(m_propertyPageFont)), 0 );
It worked more or less, but this way I'm not able to design the look-and-feel of the pages. (Texts don't fit in their space at runtime.)
I would appreciate any suggestions... Thanks in advance,
Que
|
|
|
|
|
hi,
I need to process a file which is 588 MB long and I am using MapViewOfFile to map the file into memory. the function succeeds for up to 550Mb but it starts failing after that? Why does this happen any ideas ?
thanks
karthik
|
|
|
|
|
The system is probably failing to find a contiguous block of virtual memory that large.
I would almost be willing to bet if you went to a server with IIS and Microsoft SQL running, you might not even load the 520 MB file.
I have seen systems running industrial automation software that cheese out beyond 120 MB of contiguous space.
I would suggest blocking your file into smaller, but perhaps multiple, chunks of virtual memory.
|
|
|
|
|
I want to read a nibble from an external circuit into the PC over the LPT 1 port. Can anyone give me a short lisitng for the necessary routine? Or good hints?
Many thanks in advance
cheers
|
|
|
|
|
I am trying to make multiple buttons on a page look depressed at one time. I have found where people have used bitmaps in order to do this, but the application I am working with has a large number of buttons which would require a large number of bitmaps. Is there any way besides using bitmaps/images that I can make multiple buttons on the same dialog appear pushed, depressed, when mouse clicked using any of the button styles that are possible? I have tried .SetState(true/false) but this will only work if there is a single button on a dialog.
|
|
|
|
|
Instead of creating buttons, you can create a group of checkboxes that have the "Push-Like" style, on the style property page of the checkbox in the resource editor, turned on that way you can select many of them at one and can be sunken or raised state without the checkbox connected to the text.
Hope this helps,
-Erik
|
|
|
|
|
I tried that, here are the results:
I have 3 checkbox buttons, with push-like propery set on all of them (as well as 5 other CButtons) on a dialog. When I press on a checkbox button, the button becomes depressed (I use .SetState(true/false) to do so), which is what I want. But, when I click on another checkbox button, the first checkbox button I clicked on and depressed popped back up. I tried setting the group property for the 3 checkbox buttons but this did not make any difference. Any ideas?
|
|
|
|
|
It sounds like you have them grouped. with the WS_GROUP flag. If you are still having problems, I can whip up some sample code if needed.
-Erik
|
|
|
|
|
That would be greatly appreciated. I have been tearing myself apart with this. I have tried grouped, not grouped, radio pushlike buttons, check box pushlike buttons, regular CButton buttons, everything I can think of. Anything you can give me would be greatly appreciated. Thank you very much!!!
|
|
|
|
|
Greatly appreciated assistance. Is there any way to force one of these checkbox buttons to pop back up when another button is pressed (just curious). Thanks again.
|
|
|
|
|
Yes when you mapped a variable of type control to the dialog item id, you can use the variablename.SetCheck
-Erik
|
|
|
|
|
I need to create some property pages that depends of the same dialog box, and the data stored in those property pages only differs by its owner, then I would change the caption for the assistant window when every property page would be selected.
This is my piece of code:
for (iCounter = 0; iCounter < 5; iCounter++)
{
CaptionPPAgACT.Format("Paràmeters for: %i",iCounter + 1);
m_PPag2[iCounter].m_psp.pszTitle = CaptionPPAgACT;
m_PPag2[iCounter].m_psp.dwFlags |= PSP_USETITLE;
AddPage(&m_PPag2[iCounter]);
}
Thank you in advance for your help.
|
|
|
|
|
Hi,
i want to get hwnd of control in another window from my app
and then call the getwindowtext function to get its title or value
if you have a solution related this, please to show it to me.
thank you
hqu0c
|
|
|
|
|
I suppose the other window is a dialog:
- get the control's hwnd with GetDlgItem(dlgHwnd, ctrlID)
where dlgHwnd is the dialog's window handle and ctrlID is the control id.
Paolo.
|
|
|
|
|
I am new to MFC, and I was puzzled about the principle "Object Serialize". And I wish somebody can explain it to me, how the things done. very thankful.
|
|
|
|
|
When an object is serialized, it means it is converted to a stream of data that can be stored in persistent storage, or sent across a communications channel, then reconstituted into an object at a later time.
This is usually done by writing out a code for the object type followed by the data stored in its data members, one by one. Data members that are basic types (such as char, int, long, etc.) can be streamed out just by writing their bits to the output. Data members that are user defined types (such as other objects) are told to serialize themselves, and they repeat the process, serializing their own data members, until the whole object has been serialized to the output stream as a sequence of basic types.
Data members that are pointers or references to external objects must be handled differently so that only one copy of the external object is serialized. There are various ways of doing this, depending on the library in use. Some implementations give each object that is pointed to a unique ID, and output this ID for each pointer. When the objects are reconstituted, the pointers are replaced by the address of the reconstituted external object.
Reconstituting objects from the serialized stream is the reverse of serialization. The object type is read in, and an empty object of that type is constructed. Each data serialized member is then read in turn and assigned to the new object's corresponding data member.
Note that this system requires that full details of the serialization system and the object types are available for both serializing and reconstituting the objects. Also, a default constructor (taking no arguments) is usually required when objects are reconstituted.
Dave
|
|
|
|
|
Is there a way to programmatically determine the user's proxy server settings for Windows95/98/NT?
|
|
|
|
|
Just a flier on this one, but you can get IE's proxy setting from the registry.
|
|
|
|
|
i have a static code here:
==========================================
class A{
public:
static int a;
A();
~A();
};
A::A()
{ a++;}
A::~A()
{ a--;}
main()
{
A m;
}
============================================
complie passed
linker terminate and print:
"unsloved external reference A::a"
i don't know where is wrong.
thank you first.
|
|
|
|
|
This is a weird C++ rule (I didn't know it myself 'till a couple years ago, after 6 years of doing C++), but when you have a static member variable, you also have to instantiate it. So, you need to do this (add the line in red):
class A
{
public:
static int a;
A();
~A();
};
<font color=red>int A::a;</font>
|
|
|
|
|
It's not so weird really. Because a static variable belongs to the class itself rather than an instance, it must be defined separately from an instance.
Dave
|
|
|
|
|
The static members are shared by all instances of the class where it was defined . The scope of this kind of members is in the file where it was defined , and their duration is from the start of the program until the end of the program . So ,because the static members are allocated at the compilation time , you must initilize them at the file scope , even if are private . If you don't specify a value , 0 is implicit.
|
|
|
|
|
I'm creating an interface to program industrial machines and I need to be able to control various kind of documents.
One of those docs. must be viewed using an assistant, how could I do this if the CMultiDoctemplate parameters has to be filled with CMDIChildWnd (or derived) and CView (or derived too).
An example would be very useful.
Thank you in advance.
PD: I beg your pardon if I has written something impolite, but I'm very novice speaking english too.
|
|
|
|
|
After receiving a little bit of help I have solved the problem:
I have created three classes: one document derived, another view derived, and a ChildFrame derived of a CMDIChild, and in this last one I have written:
BOOL CChildFrmS7::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
m_PS->SetWizardMode();
m_PS->Create(this,WS_CHILD | WS_VISIBLE);
m_PS->SetActivePage(0);
CreateView(pContext);
return TRUE;
}
int his way I have got the property sheet in a MDI environment, but there is a little problem:
when the application erases the background, the body of the active page of the propertysheet disappears, I have overriden the OnEraseBackground message, but The window borders are not painted then.
How should I get the borders painted and the contents of the MDIChildwindow don't?
|
|
|
|