|
|
How is the color of a font stored and processed? I see that the LOGFONT structure does not have a member for the color, nor does CFont .
How does the system keep track of the color of a font?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
It doesn't; fonts do not have a colour attribute. When writing text to a device context you select the appropriate foreground and background colours that you wish to use.
Veni, vidi, abiit domum
|
|
|
|
|
Oh I see. I guess it depends upon what brush I use?
Thanks, Richard.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
it's not a brush or pen, there's a GDI function called SetTextColor.
|
|
|
|
|
For text, the APIs used for color are SetTextColor and SetBkColor .
|
|
|
|
|
|
I have two applications that has a same structure and these two applications communicates values using the structure in shared memory created using CreateFileMapping, OpenFileMapping and MapViewOfFile. So Whenever a value in the structure is changed by application 1, it gets reflected in appliction 2 and viceversa. This is fine.
But the 2 applications are running in the same machine. Now I want to make the 2 applications run in separate machines connected within a LAN and I require the same functionality (i.e. Communication between the 2 applications) without any synchronization issues.
Anybody, Please suggest me the best way to implement this and also the step by step method of code to achieve this. .
|
|
|
|
|
Please do not crosspost the same message in multiple forums.
Veni, vidi, abiit domum
|
|
|
|
|
Hi Everyone,
I want to place MFC control in RunningObjectTable. Is this possible?. If yes how can we place it in RunningObjectTable?
Regards,
Rajendar.
|
|
|
|
|
|
For inter process communication
|
|
|
|
|
Rajendarmanda wrote: For inter process communication OK, and what exactly does that add by way of explanation? Please think about what problem you are trying to solve, and give some proper details of where you are stuck. If your question begins with "How do I ...", or "Is it possible ...", then you will most likely find some useful information through Google searches.
Veni, vidi, abiit domum
|
|
|
|
|
Actually we have placed COM object into RunningObjevtTable(ROT) but when we try same thing for MFC it is not working. we are suspecting whether we put MFC object into ROT or not?
|
|
|
|
|
Rajendarmanda wrote: when we try same thing for MFC it is not working. Then you will need to do some debugging to try and identify why.
Veni, vidi, abiit domum
|
|
|
|
|
I am trying to run a modal dialog in a property page.
The dialog is located in static library.
Here is the implemetation of DoModal
int C_MAINPropertyPage4::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CPropertyPage::OnCreate(lpCreateStruct) == -1)
return -1;
pCWaveInFFTDlg.DoModal();
return 0;
}
And here is where CDialog fails, in FindResource:
// load resource as necessary
LPCDLGTEMPLATE lpDialogTemplate = m_lpDialogTemplate;
HGLOBAL hDialogTemplate = m_hDialogTemplate;
HINSTANCE hInst = AfxGetResourceHandle();
if (m_lpszTemplateName != NULL)
{
hInst = AfxFindResourceHandle(m_lpszTemplateName, RT_DIALOG);
hInst looks OK
HRSRC hResource = ::FindResource(hInst, m_lpszTemplateName, RT_DIALOG);
hResource is NULL, so it fails from here on.
hDialogTemplate = LoadResource(hInst, hResource);
}
if (hDialogTemplate != NULL)
lpDialogTemplate = (LPCDLGTEMPLATE)LockResource(hDialogTemplate);
// return -1 in case of failure to load the dialog template resource
if (lpDialogTemplate == NULL)
return -1;
When I run this dialog in its own project the hInst returns same value as when I run it in my application. The m_lpszTemplateName is also same , empty, when run in its own project or in my application.
I did run the DoModal in property page OnInitDialog with same result.
I did copy the source from the original to my static library and I am at lost what “resource template” is missing.
Any help would be appreciated. Of course I am still using VC 6.0 and MFC.
Cheers
Vaclav
|
|
|
|
|
Every module (exe or dll or whatever) can contain a resource tree that contains different kind of resources (icon, dialog template, cursors, wav sound, popup menus, binary data, ... the list is increasing). You usually compile an .rc file into a .res file and currently you can link only one .res file into the final module (exe or dll) and the linker composes the (search) tree from the resource list. Resources declared in a static libs don't link to the modules from which you use the static libs themselves. Correct me if I'm wrong but I've burnt myself with this several times so I avoid using resources in static libs. To my best knowledge there is no solution to this problem in newer visual studio versions. http://stackoverflow.com/questions/531502/vc-resources-in-a-static-library[^]
If you compile your library as a DLL then your DLL can have its own resources and you can use the HMODULE received as the first parameter of the DllMain() as your hInst when you call FindResource().
Additional advice: Use ResHacker to check out the resource tree of an exe or dll.
|
|
|
|
|
Found a note that you should be able to use “additional includes directory” to link to the static module resources, but it did not work.
Basically – the static library gets build and the .res / .rc gets also build and included in the build.
But the main application will not retrieve the “dialog template” from the library.
So putting CDialog derived class in static library is worthless.
I am going to build the page “dialog” directly and forget about using the static library “external” dialog.
I was just hoping that putting the dialog in static library I can keep the supporting classes together with the dialog itself. I was just trying to offload the “module” classes from the main application.
No big deal.
I still do not get where the “template” addition to “dialog” came from. But that is irrelevant now.
|
|
|
|
|
http://msdn.microsoft.com/en-us/library/kcz8ck35.aspx[^]
Quoting the link:
"You can specify a .res file when linking a program."
Before posting my previous answer I tried on the commandline to link a DLL with two res files, both containing an icon (with VS2010). It didn't work. If it doesn't work on low level on the commandline it cant work from the devenv/IDE that also uses these commandline tools.
|
|
|
|
|
In VC 6.0 there is an option in Project Setting -> Resources ->Additional resources include directories.
It did not work.
Terrible though – VC 6.0 wizard for creating static library does have an option to “use “ MFC, but does not have an easy way to add MFC derived classes. ( I posted the question about it here but got nowhere – some folks just don't want to be bothered with “obsolete “ VC6.0 questions).
So there are no MFC message queues available , hence “standard “ termination of modeless dialog- using OK button- does not exist. Maybe that is the real reason why this additional resources include does not work.
But you tried it with icon, so, I may be totally off in the left field with this.
|
|
|
|
|
hi
i have instled vc++6.0 and executes a threading projects it asking activex controls not installed
|
|
|
|
|
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Find the ActiveX that is missing and register it using the command line - regsvr32 <activex_name>.ocx
|
|
|
|
|
I have this method which creates a CDialog containing controls / info about DirectShow filter.
I would like to access the dialog and use the controls to adjust the filter properties.
I posted this in DiectShow forum and getting nowhere.
I have no clue how to do this.
Any help would be greatly appreciated.
Cheers Vaclav
FILTER_INFO FilterInfo;
hr = pCurrFilt->QueryFilterInfo(&FilterInfo);
IUnknown *pFilterUnk;
pCurrFilt->QueryInterface(IID_IUnknown, (void **)&pFilterUnk);
CAUUID caGUID;
pProp->GetPages(&caGUID);
pProp->Release();
OleCreatePropertyFrame(
this->m_hWnd, // Parent window
0, 0, // Reserved
FilterInfo.achName, // Caption for the dialog box
1, // Number of objects (just the filter)
&pFilterUnk, // Array of object pointers.
caGUID.cElems, // Number of property pages
caGUID.pElems, // Array of property page CLSIDs
0, // Locale identifier
0, NULL // Reserved
);
PS the FilterInfo contains dialog box title / name and pointer to the graph itself only.
|
|
|
|
|
If you want to modify gui elements programmatically then it is a big hack that may or may not work on other machines. Even if we know how to do this magic we don't know what you want to do and we can't read your mind to find it out. It is possible to traverse the window/child control hierarchy and if you can identify certain controls then you can manipulate them. Often identifying the controls is possible by their/their parents' Z order and/or control ID. Depending on what you want to do different kind of hacks/functions may be necessary.
EDIT: as a first step you should write a function that prints out the full window hierarchy of your dialog along with some extra info with each child control window (like hwnd value, control id, classname). Use the GetWindow() function to traverse the window (tree) hierarchy. At the same time you should check the properties of the child controls you want to manipulate with Spy++. This way you can find the location of a control in the hierarchy and write the code that somehow programmatically retrieves the necessary HWNDs from the hierarchy for you. When you are done you will have to manipulate the gui controls by calling windows functions and sending messages to the HWND of the given control.
EDIT: Here is a piece of code that prints you the tree you can view with Spy++. This small piece of code contains a few function calls that can come handy when its about getting the HWND of a specified child control in the gui hierarchy:
void PrintInfo(HWND wnd, int level)
{
for (int i=0; i<level; ++i)
printf(" ");
char classname[0x100];
classname[GetClassNameA(wnd, classname, sizeof(classname))] = 0;
printf("HWND=%p ctrl_id=%d classname='%s'\n", (void*)wnd, GetDlgCtrlID(wnd), classname);
}
void TraverseTree(HWND parent, int level)
{
PrintInfo(parent, level);
++level;
HWND child = GetWindow(parent, GW_CHILD);
if (!child)
return;
do
{
TraverseTree(child, level);
child = GetWindow(child, GW_HWNDNEXT);
}
while (child);
}
void WindowFunc()
{
HWND wnd = FindWindowA("Afx:00400000:b:00010005:00000006:000B078D", NULL);
if (!wnd)
ExitProcess(1);
TraverseTree(wnd, 0);
ExitProcess(0);
}
modified 18-Sep-13 10:43am.
|
|
|
|