|
The same way you would any other Windows (WM_xxx ) message. If you are using MFC, use ClassWizard (Ctrl+W) to provide a handler for that message.
Here is another resource:
http://www.mser.net/microsoft-developer-network/43/visual-c++-programming-430579.shtm[^]
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hey,
how can I change (dynamic) the view from e.g. CView to CFormView? I know I have to do it in mainfrm but how?
|
|
|
|
|
|
|
Hey,
i've made some good controls and dialogs for me. From that time on, i'd copied all my files and resources to my new projects. Now I decided to make an DLL. So I started the project assistant and created a extended MFC-Dll and added my custem files and resources. So i build my DLL...
OK, but now (after linking to my new projects) I have probleme with my resources. Is there any to way to split resources or better use separate resources (one resource for application, one for dll).
Thank you for helping me....
|
|
|
|
|
AnTri wrote: I have probleme with my resources.
What problems?
AnTri wrote: Is there any to way to split resources or better use separate resources (one resource for application, one for dll).
The resources are separate for the DLL and the EXE. It's mostly a matter of
loading from the right module.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
When I link my (control) dll I'll get a lot of compiler-warnings: resource already defined, duplicated resource ...
e.g. in dll is a dialog with edit-control ID: IDC_EDIT1 = 1001
when I link the dll to my application e.g. Dialog with the same ID for edit-control I can't open the dialog! It seems that there is only one resource-list for the application an my dll!
|
|
|
|
|
MFC maintains a list of modules with resources, and loads them from wherever it can.
The simple solution is to make sure your resource IDs don;t overlap.
If you do a search for Anna Jane Metcalfe, she wrote an article with a utility to make reorganising resources much easier.
If you can't find it on CP, go look at her site: www.riverblade.co.uk, and prod around there. It wasn't hard to find.
Iain.
|
|
|
|
|
This should be a simple problem, but I am unable to solve it! My environment is VStudio 2005 and MFC.
The issue is printing text onto a DC. Should be simple enough, but here are some constraints:
1. The text may be rotated 0, 90, 180, 270 degrees.
2. The text may need reformatted within the bounding rectangle, meaning word-breaks.
3. The text will need to be aligned horizantally and vertically within the bounding rectangle - left, right, and center horizontally, top, center, bottom vertically.
Rotating text is not a problem.
Normally, I could use DrawText to print the text, but on rotated fonts, DrawText seems to choke. I tried TextOut and ExtTextOut. These rotate and position just fine, but can't seem to do word-wrap.
Is there an API call or setup that I am missing? Or do I need to draw to a memory DC and somehow rotate it to fit?
Or can someone please point me to some code that will accomplish this easily?
Thank you for your time
|
|
|
|
|
It might be Q&D, but what about drawing the text onto an in-memory bitmap/surface and then rotating it, and then blitting it to the target bitmap/surface?
Other than that, maybe the GDI+ libraries have something to offer?
Peace!
-=- James Please rate this message - let me know if I helped or not!<hr></hr> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Unfortunately, I am out of options at this point... In-Memory bitmap and rotate would have to be the answer. I was kind of hoping some built-in API.
|
|
|
|
|
Stephen,
I am not familiar with the World Transform functions, so I will have to go through the sections to pick up on them, but thank you for pointing me at them. From the initial look I had, they do look promising.
Santanu
|
|
|
|
|
Stephen,
Your suggestion was exactly what I needed. I used the SetWorldTransform API to rotate and align text along the required axes and let DrawText do the wordwrap part.
Thank you very much.
|
|
|
|
|
How do you reverse the action on a Spin control? Currently, down makes the number go up, and clicking the up arrow makes the value go down. How do you reverse the control, so the up arrow increases the number, and down decreases it?
|
|
|
|
|
littleGreenDude wrote: How do you reverse the action on a Spin control? Currently, down makes the number go up, and clicking the up arrow makes the value go down. How do you reverse the control, so the up arrow increases the number, and down decreases it?
They hide that information in the documentation[^]
led mike
|
|
|
|
|
A more useful response...
Set the range to anything other than the default 0 to 100 and the control behaves normally.
m_Spin1.SetRange(0, 52);
The up-down control is a victim of Windows' reversed y-axis.
Mathematically, the (0, 0) coordinate should be at the bottom left corner of the screen, with y increasing as you move up the screen. Windows, on the other hand, puts the (0, 0) coordinate at the upper left corner, with y increasing as you move down the screen.
|
|
|
|
|
Hey Clown, you make the questions and the answers ?!
|
|
|
|
|
Sorry, thought it was my circus too....
|
|
|
|
|
toxcct wrote: Hey Clown, you make the questions and the answers ?!
I don't want to start an argument but I don't see any answers provided by the clown.
you haven't told us what your problem is (apart from an inability to think clearly).
Pete O'Hanlon - the C# forum
|
|
|
|
|
The Clown wrote: A more useful response...
Set the range to anything other than the default 0 to 100 and the control behaves normally.
m_Spin1.SetRange(0, 52);
he asked how to do the trick, and then, he just tell how to solve it as anybody else would answered him
|
|
|
|
|
littleGreenDude wrote: A more useful response...
hmmm that link was pretty useful...
"Clicking the up arrow moves the current position toward the maximum, and clicking the down arrow moves the current position toward the minimum. By default, the minimum is 100 and the maximum is 0. Any time the minimum setting is greater than the maximum setting (for example, when the default settings are used), clicking the up arrow decreases the position value and clicking the down arrow increases it."
Send in the clowns.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello everybody ,
i created a function (fnLBE_GdtIn(int enEing)) in a Win32 Dll.
In this function i use the stl string class (dynamic string arrays) to work with the strings.
The result (return values) are different dynamic string arrays which i have to convert to BSTR cause i have to return them to VB !!!!!
I know how to pass BSTR to VB but i don't know how to convert dynamic string arrays to BSTR !!!
Here is the code (it is not complete i haven't sent the filling of the arrays ans so on because it is to much code, hope this is enough !)
<br />
LBE_GDTIN_API BSTR _stdcall fnLBE_GdtIn(int enEing)<br />
{<br />
int i = 0, j = 0, k = 0, l = 0;<br />
ifstream f;<br />
string sRead;<br />
string *arrGdt;<br />
string *arrClean;<br />
string *arrRelease;<br />
string *arrSearch;<br />
int len = 0;<br />
<br />
arrSearch = new string[4];<br />
arrSearch[0] = "3101"; <br />
arrSearch[1] = "3102"; <br />
arrSearch[2] = "3103"; <br />
arrSearch[3] = "3110"; <br />
<br />
<br />
arrGdt = new string[len];<br />
arrClean = new string[len];<br />
arrRelease = new string[len];<br />
<br />
switch(enEing)<br />
{<br />
case 3101:<br />
while (k < len)<br />
{<br />
if (arrSearch[0] == arrClean[k].erase(4,arrClean[k].find("/n")))<br />
{ <br />
<br />
return arrRelease[k];<br />
}<br />
k++;<br />
} <br />
break;<br />
<br />
and so on .......<br />
Many Thanx For Your Help ...
hopefully & best regards
Croc
|
|
|
|
|
Why are using arrays of strings rather than an STL collection?
led mike
|
|
|
|
|
Hi mike,
that's right, I solved the prob like :
<br />
string ret;<br />
ret = arrRelease[k];<br />
now I have simple stl strings to convert !
Itried it with
<br />
return CComBSTR (ret.c_str());<br />
but it still not works
Could you help me with a convertion fron simple stl string to BSTR ???
hopefully & best regards
Croc
|
|
|
|
|
You need to convert the string to unicode, or just use unicode from the beginning. (I recommend the latter.) If arrRelease was an array or vector of wstring, then you could use something like return SysAllocString(arrRelease[k].c_str()) Also, I agree with Led Mike that STL containers like vector<string> are much more appropriate than string *
Nathan
|
|
|
|