|
|
You might have to use CDC::GetOutputTextMetrics() along with GetTextExtentExPoint() . Add size.cx and tm.tmAveCharWidth together to see what that produces. Don't forget to select the static control's font into the DC before taking any measurements.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: select the static control's font into the DC
Great!!
Now it works!
Thank for your time.
Have a nice code day
|
|
|
|
|
Just a suggestion, you can wrap text in a static control.
Nibu thomas
Software Developer
|
|
|
|
|
I have a VC++ MFC application in VS 2005. In this application I use CPropertySheet's in several locations. The program works fine for a while, but at some point the CPropertySheet's stop working, in such a way that when I click on a CPropertyPage tab, the tab for that sheet disappears completely or the controls on that CPropertyPage are all invisible. I'm guessing that I'm running out of resources, handles, memory, etc.
Can somebody advise me on what to look for in the way of resources or memory, so that I can circumvent this problem? Also, what utilities would be useful to diagnose the problem? At the very least, I'd like to have the program detect the problem and warn the user to save their results.
Thanks
B Jacobs
-- modified at 14:41 Wednesday 8th March, 2006
|
|
|
|
|
hi
i have a small app im putting together. i have put in a "IP Address" box and have a button then when click will store the ip address.
from what i can see you use CIPAddressCtrl::GetAddress to get this address, what am i doing wrong below? I am using vc++6.
BYTE nField0, nField1, nField2, nField3;
int rc = CIPAddressCtrl::GetAddress(nField0, nField1, nField2, nField3);
should that not put the address into each one of those byte fields?
i am getting an error as below..
error C2352: 'CIPAddressCtrl::GetAddress' : illegal call of non-static member function.
afxcmn.h(1112) : see declaration of 'GetAddress'
please help
thanks
|
|
|
|
|
GetAddress() is not a static member. It must be called in the context of a CIPAddressCtrl object. Use ClassWizard to associate the control with a CIPAddressCtrl object.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
many thanks for the reply
can you further explain this as MFC is new to me?
thansk again
|
|
|
|
|
keithlee wrote: can you further explain this as MFC is new to me?
Which part? Use Ctrl+W to open ClassWizard. Click the Member Variables tab. Select the desired control and click the Add Variable... button.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
stupid me!! i had that already done with out knowing it
m_strIP2.GetAddress(nField0, nField1, nField2, nField3);
did the trick then
thanks for your help
|
|
|
|
|
i guess &buf return the address of buf and *buf is a pointer of buf. what is the importanc of using both of them??
what is the advantages of VC++ compared to VBasic??
i used fread to read a text file. then i want to insert the character of ' '(space) in betwen two words. does it effect the adress of the word in the file??
HelpMe
|
|
|
|
|
beardy janggut wrote: what is difference of &buf and *buf??
depends if you're talking in a declaration, or when using the variable.
MyType t;
MyType* pt;
MyType& rt;
pt = &t;
*pt = ;
rt = t;
rt = ;
beardy janggut wrote: what is the advantages of VC++ compared to VBasic??
Visual Basic is no way comparable with C++. C++ (thus Visual C++) produces natice code. native code is a binary code which is undertood directly by the microprocessor.
any Visual Basic before VB.NET were interpreted languages.
moreover, when C++ can do anything on a computer, Basic languages are pretty limited.
one last thing about VB vs C++. Basic languages are too much permissive and can let the developer take bad habits at programming. in C++, the compiler and the linker are quite strict in this way.
|
|
|
|
|
& is used to get the address of a variable: int Test = 7; , now, &Test will be the adress of the Test variable.
* is used to get the content pointed by a pointer. So, *(&Test) will give you 7 (wich is the content of the address).
beardy janggut wrote: what is the advantages of VC++ compared to VBasic??
Lots of things have been written about this subject, it is not like saying C++ or VB is better. It depends of your expectations. (Althought, lot of people here will say you that VB is crap ).
beardy janggut wrote: i used fread to read a text file. then i want to insert the character of ' '(space) in betwen two words. does it effect the adress of the word in the file??
You can't insert text like that in a file. You need to create a new file, write the data that is before what you want to insert, then write what you want to insert and finally write the rest of the data.
|
|
|
|
|
I'm trying using the IShellBrowser::BrowseObject function. After a hard working, finally it works. But now I found that it doesn't work on Windows 98 although it returns NOERROR.
Any one can help me?!!
M.N
|
|
|
|
|
Hello,
I have MS Word as the top window and a document is opened (let’s say Test.doc). I am wondering if there is a way to find out the path in which the Test.doc file is located (on a local folder or on a network share). Does anyone know a good article?
Thank you.
|
|
|
|
|
See if MSDN article Q183599 is of any help. It's not a direct answer to your question, but it may point you in the right direction, which is often a better choice anyhow.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Dear David,
Thank you very much. It seems that the article is a good approach of what I am looking for.
Best Regards,
|
|
|
|
|
You might be able to get away with something like:
_Application WordApp;
_Document Doc;
LPDISPATCH pDisp;
LPUNKNOWN pUnk;
CLSID clsid;
::CLSIDFromProgID(L"Word.Application", &clsid);
if (::GetActiveObject(clsid, NULL, &pUnk) == S_OK)
{
VERIFY(pUnk->QueryInterface(IID_IDispatch, (void**) &pDisp) == S_OK);
WordApp.AttachDispatch(pDisp);
pUnk->Release();
Doc = WordApp.GetActiveDocument();
CString str = Doc.GetFullName();
}
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
I am writing a program that uses data structures such s std::vector and std::map and when I write a class that uses the structures and put the class in a dll, the compiler warns me against this saying the template classes cannot be exported.
Warning I recieved:
warning C4251: 'a' : class 'vector<int>' needs to have dll-interface to be used by clients of class 'MyClass'
a is a std::vector in my class MyClass
I get similar messages with std::map and the other data structures of the STL
Is there anyway around this problem because I do not want to write my own data structures but instead I want to use the STL.<code></code>
pplshero54 gives his most thanks
|
|
|
|
|
I am using Visual C++.NET
pplshero54 gives his most thanks
|
|
|
|
|
did you correctly said that std::vector<> had to be exported from the DLL with a mechanism such as __declspec( dllexport )
|
|
|
|
|
yes, I did all the correct __declspec stuff
pplshero54 gives his most thanks
|
|
|
|
|
How to acquired a pointer to Internet Explorer's IWebBrowser2 interface from IOleClientSite and IOleContainer?
Thanks
|
|
|
|
|
what do you need? IWebBrowser2 or IOleClientSite
|
|
|
|
|
Need to run this:
IOleCommandTarget* pCmdTarg;
CComPtr pWB;
CoCreateInstance(CLSID_WebBrowser, NULL, CLSCTX_INPROC, IID_IWebBrowser2, (void**)&pWB);
pWB->QueryInterface(IID_IOleCommandTarget, (void**)&pCmdTarg);
VARIANT vTemplatePath;
V_VT(&vTemplatePath) = VT_BSTR;
CComVariant vPTPath = argv[1];
pCmdTarg->Exec(&CGID_MSHTML, IDM_PRINTPREVIEW, NULL, &vPTPath, NULL);
But the pointer don't work.
|
|
|
|