|
hi,
i've written a program using a formview and several dialogs, mainly created with the ressource-editor of visual studio. the problem is, that for some users the gui is not displayed the right way. i think, they are using a different font or fontsize than i do.
what can i do, to ensure, that all users of the application see the same like i see? do i really have to define a standardfont and attach it to every little cstatic-object? every program i know, does not make such problems, so there must be a way, to prevent such display-errors.
thanks
|
|
|
|
|
namdans wrote:
what can i do, to ensure, that all users of the application see the same like i see?
You can't, nor should you want to. If I have my system set up to use some fancy-dancy font, and your app comes along and uses its own font, I'm not going to be happy. In other words, let the user configure their own system (e.g., font, color, scheme) via Control Panel, and simply respect those settings in your application. Unless you code around this, this happens by default.
namdans wrote:
do i really have to define a standardfont and attach it to every little cstatic-object?
No, this is hardly, if ever, necessary. Unless you are writing a specialized application where fonts are part of the design, let the OS handle them.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
David,
Do you know how to get access to the windows fonts for using with drawing text on a dc. I want my application to use the system settings but i dont seem to be able to get hold of the correct font. What should i be doing?
Cheers,
Andy.
|
|
|
|
|
I am using the AfxBeginThread, with a global function ThreadProc(LPVOID), i do some background processing ie a while loop is executing infinitely but due to that execution i have to update some controls on the Dialog.
This updation is not occurring rather an error message
comes that u can't modify a C++ class inside the thread
Please can someone tell me what is the problem and the solution...thanks
Ever Welcome...
|
|
|
|
|
You can pass in a parameter to a thread function.
CWinThread* AfxBeginThread(
AFX_THREADPROC pfnThreadProc,
LPVOID pParam, <-- the parameter
int nPriority = THREAD_PRIORITY_NORMAL,
UINT nStackSize = 0,
DWORD dwCreateFlags = 0,
LPSECURITY_ATTRIBUTES lpSecurityAttrs = NULL );
CWinThread* AfxBeginThread(
CRuntimeClass* pThreadClass,
int nPriority = THREAD_PRIORITY_NORMAL,
UINT nStackSize = 0,
DWORD dwCreateFlags = 0,
LPSECURITY_ATTRIBUTES lpSecurityAttrs = NULL );
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
void CMyDlg::StartThread()
{
AfxBeginThread(MyThread, this, THREAD_PRIORITY_.....);
}
UINT MyThread(LPVOID pParam)
{
CMyDlg *pMyDlg = (CMyDlg *)pParam;
...
...
...
...
}
|
|
|
|
|
It's hard to discern from your description, but if your secondary thread is trying to update a control owned by the primary thread, trouble is right around the corner. When an update is needed, the secondary thread should post a message to the primary thread indicating what needs to be done.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hi,
I have a program in which I have to activate / deactivate different menu options in different stages of the program.
How can I do this?
I also have to activate / deactivate a toolbar. I've managed to do this at startup by chaging the commands id's with SetButtonInfo. When I want to activate I use again SetButtonInfo to associate the right commands to the buttons and then the toolbar becomes active. If I try to change again the commands ids the toolbar doesn't deactivates again.
-----
We are what we repeatedly do. Excellence, then, is not an act, but a habit.
|
|
|
|
|
I have to develop an application that "sniffs" all UDP
packets sent over the LAN.
How can I develop this functionality ??
Are there some VC++ sample applications ??
Thanks a lot !!!
|
|
|
|
|
See WinPcap[^]
Cheers,Joao Vaz
Three primary LAN architectures for Network Engineers,
under the sky,
Seven OSI layers for the Open System Architects,
in their halls of stone,
Nine N-xDU operations* for mortal Developers,
doomed to die,
One protocol suite for the Dark Sysadmin,
in his dark server room,
In the land of mordor.net,
where the shadowed fibers lie
|
|
|
|
|
Hi all,
I want to declare on a method that one of its parameter is a pointer to a function. the function is not the same for each call, meaning it can get different parameters each time..... i know i need to use the 3 dots to define the undetermined parameters....
touble is i am not familier with the syntax of either cases.....
can any1 help plz?
thanks in advanced
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
|
tons of thanks!
cheers
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Try something like...
typedef void (* TFunction)(int param1, ...);
void MyFunction(TFunction pF)
{
pF(90, 30, 20, 10);
};
Best regards
jAB
|
|
|
|
|
thanks man,
that's really helpfull
cheers
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
an other question please...
what is the syntax for calling the MyFunction?? what do i pass as parameter for TFunction PF??? can u show me code
thanks
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Here is the whole code...
typedef void (* TFunction)(int param1, ...);
void MyFunction(TFunction pF)
{
pF(90, 30, 20, 10);
};
void OtherFunction(int param1, ...)
{
// Do something
}
// Calling...
...
MyFunction(OtherFunction);
...
|
|
|
|
|
thanks..
c code is a little misunderstood for me... i will describe the problem i have in c++ maybe you can write the proper example code :
the class CBDRMainDlg contains the called method :
class CBDRMainDlg
{
public
.
.
void ClearIt();
};
the class also contains a function called add that one of its parameters is a pointer to the method ClearIt:
class CBDRMainDlg
{
public
void Add(
.
.
void ClearIt();
};
out side the class in on other class i am defining an object of the class:
...
...
CBDRMainDlg dlg;
dlg.DoModal();
see all the remarks above, can u replace them with the proper code?
thanks again for all your help
Cheers
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
This is sintactically correct:
class CBDRMainDlg;
typedef void (CBDRMainDlg::* DlgMethod)(void);
class CBDRMainDlg
{
public:
void Add(DlgMethod method)
{
};
void ClearIt()
{
printf("Clear It");
};
};
int main(int argc, char* argv[])
{
CBDRMainDlg dlg;
dlg.Add(CBDRMainDlg::ClearIt);
return 0;
}
... but i can't figure out how to call the method inside 'Add' since the compiler needs to push the this pointer in the stack before make the calling. It is possible using inline asm but i think that is not the best solution...
Why do you want to call methods this way? I think you can do that using virtual methods...
|
|
|
|
|
I have a problem, I´m trying to use the IP address control in a VC++ 5.0 project. The code should be ok, but, when the resources are to be compiled, it does not recognise the SysIPAddress32 control.
Does anybody have a solution for this, i.e. do I have to set the control (in the resource editor) as a custom control, and if yes, how?
Thanks in advance
Phil
bum... and I thought I´d got rid of all the bugs
|
|
|
|
|
HI,
are you able tyo create CIPAddressCtrl
and use ??
please help me if you can
thanks
sarfu
|
|
|
|
|
Sorry, but if you look at the date, this is over 6 years ago, and for the life of me I can't remember how I got it to work... I've moved onto "Greener Pastures" now
Cheers
Phil
Who the f*** is General Failure, and why is he reading my harddisk?
|
|
|
|
|
Hi,
I need some help please.
I tried to figure it out, but with no success so far.
Why do I get E_INVALIDARG when I try to use the appendChild Function.
This is my source code:
IHTMLElement* pHTMLElement;
IHTMLElement* pNewHTMLElement;
IHTMLDOMNode* pHTMLDOMNode;
IHTMLDOMNode* pNewHTMLDOMNode;
IHTMLDOMNode* pNew2HTMLDOMNode;
IDispatch* pDisp;
v.vt = VT_BSTR;
v.bstrVal = SysAllocString(L"HEAD");
hResult = pIHTMLElementCollection->tags(v,&pDisp );
if (hResult == S_OK)
{
hResult = pDisp->QueryInterface(IID_IHTMLElementCollection,(void**)&pIHTMLElementCollection);
if (hResult == S_OK)
{
pIHTMLElementCollection->get_length(&lCollectionSize);
v.vt = VT_I4;
v.lVal = 0;
hResult = pIHTMLElementCollection->item(v,v,&pDisp);
if (hResult == S_OK && pDisp != NULL)
{
hResult = pDisp->QueryInterface(IID_IHTMLElement,(void**)&pHTMLElement);
if (hResult == S_OK)
{
hResult = pHTMLElement->QueryInterfa(IID_IHTMLDOMNode,(void**)&pHTMLDOMNode);
if (hResult == S_OK)
{
bstrTemp = SysAllocString(L"BASE");
hResult = pIHTMLDocument2->createElement(bstrTemp, &pNewHTMLElement);
SysFreeString(bstrTemp);
if (hResult == S_OK)
{
bstrTemp = SysAllocString(L"href");
v.vt = VT_BSTR;
v.bstrVal = strWebPageDomain.GetBuffer();
hResult = pNewHTMLElement->setAttribute(bstrTemp, v, 0);
SysFreeString(bstrTemp);
if (hResult == S_OK)
{
hResult = pNewHTMLElement->QueryInterface(IID_IHTMLDOMNode,(void**)&pNewHTMLDOMNode);
if (hResult == S_OK)
{
****************************************************************************
hResult = pHTMLDOMNode->appendChild(pNewHTMLDOMNode, &pNew2HTMLDOMNode);
****************************************************************************
}
}
}
}
}
}
}
}
}
}
|
|
|
|
|
Good morning,
I have a problem with adding an file to a mail.
This process should use OLE Automation. I already figured out all the other things, but I'm not able to do that...
I also found no help in the msdn library, so you out there are my last chance...
Thanks in advance.
|
|
|
|
|
Hi there,
I have created a MDI Application which has two view(one derived from CEditView and other with CView) and get the data from one Document. No my problem is that i have used the method for Open/Save Filters using the article in this site and when i open the txt it is opening CEditView but the problem is that it is not opening the contents in the file. How to solve this problem if anybody knows plz reply me fast.
Sreeramachandra G
|
|
|
|
|