|
I create a applicaion named PipeLine .
I add a dialog named Connect and insert a EditBox resourse with a ID called IDC_CONNECT .A variable named m_conn is relevant to the ID ,that is IDC_CONNECT, maybe it's an unnecessary move.
What I want to do is to call m_conn in the CPipeLineApp.
Please do me a favor.Very grateful.
|
|
|
|
|
Jokcy wrote: What I want to do is to call m_conn...
This makes no sense. You don't call an edit box. You can, for example, access it by setting/getting the text.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
Maybe I don't make myself understood.Please let me make it clear.The variable m_conn is attached to the IDIDC_CONNECT .
I want to access the it in CPipeLineAPP
|
|
|
|
|
Jokcy wrote: I want to access the it in CPipeLineAPP
That usually indicates a bad design. The dialog object should implement public getter/setter methods instead.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
En ,I have realized it.So Changes have been made.Thank you .
|
|
|
|
|
As David said you must use getter/setter methods in the dialog class to access the variable.
So to get the value of m_conn , add a method called GetConn in the Connect class.
Now using the object that you created with the Connect class, call its GetConn method.
|
|
|
|
|
I've tried it.Do not get value of dialog variable.
Maybe I don't make myself understood.Please let me make it clear.The variable m_conn is attached to the ID IDC_CONNECT .
I want to make m_conn as a extern variable and access it in CPipeLineAPP
modified on Sunday, March 13, 2011 3:27 AM
|
|
|
|
|
How is m_conn "attached" to IDC_CONNECT.
|
|
|
|
|
For ID value is theIDC_CONNECT CEditBox resources added associated variables m_conn
|
|
|
|
|
I am guessing here as your question is not very clear, but I think you probably need to use the GetDlgItemText() [^] function to get the text from the edit box and store it in your variable. You can do this in your DlgProc() when you handle the OK response.
I must get a clever new signature for 2011.
|
|
|
|
|
Thank you for noticing my question.I've got it.
By the way ,do you know how to paste or insert a picture here .
Because ,as you know ,a picture can speak a lot of things
|
|
|
|
|
Jokcy wrote: By the way ,do you know how to paste or insert a picture here .
I don't think you can do that directly in these forums. Most people post their pictures to a free sharing web site and post the link in their question.
I must get a clever new signature for 2011.
|
|
|
|
|
Anyway ,thank you all the same.I will make my words more easily to be understood.Because I am so poor in English.
do my best to pursue knowledge
|
|
|
|
|
You do not need to apologise for your English; most of us have no other language.
However, do try and respond as clearly as you can when people ask for more information on your questions. Most of the time they are trying to help to solve your problem, and understanding your question is the first step.
I must get a clever new signature for 2011.
|
|
|
|
|
OK.I will.Once again thank you for your advice.
|
|
|
|
|
I was browsing through the web and trying to find the method of double buffering to load an bmp image. I get all the example, except I can't seems to find anyway to actually draw the bmp file into the memhdc. to be precise I will get an example code here.
hdc_mem = CreateCompatibleDC(hDC);
bmp_mem = CreateCompatibleBitmap(hDC, 80, 25);
hdc_mem = LoadBitmap(hInst, MAKEINTRESOURCE(ID_for_BMP));
SelectObject(hdc_mem, bmp_mem);
BitBlt(hDC, 100, 50, 180, 75, hdc_mem, 0, 0, SRCCOPY);
DeleteDC (hDC);
DeleteDC (hdc_mem);
DeleteObject (bmp_button);
In the part where I should write stuff into hdc_mem, and I did LoadBitmapbut nothing is drawn on the screen. If i take the LoadBitmap line away, it will draw me a black box.
what should I do? any links for any example?
|
|
|
|
|
You code does not suggest you are attempting to double buffer but since that is the topic you stated you are trying to understand, I would suggest this article first. (Your question will be answered indirectly in there)
Flicker Free Drawing In MFC[^]
|
|
|
|
|
ahh its MFC.. please gimme some winapi/C example tyvm
|
|
|
|
|
Are you seriously trying to tell me that you can't derive the WIN32 from the simple MFC wrappers? Most C/C++ programmers could easily convert between the two since all it really encapsulates (loosely) are the handles.
You're kidding right?
|
|
|
|
|
LoadBitmap() returns a handle to a BitMap not a device cobntext, see here[^].
I must get a clever new signature for 2011.
|
|
|
|
|
Try this:
BITMAP bm = { 0 };
HBITMAP hbm = LoadBitmap(hInst, MAKEINTRESOURCE(ID_for_BMP));
if (hbm && GetObject(hbm, sizeof(BITMAP), &bm))
{
hdc_mem = CreateCompatibleDC(hDC);
SelectObject(hdc_mem, hbm);
BitBlt(hDC, 100, 50, bm.bmWidth, bm.bmHeight, hdc_mem, 0, 0, SRCCOPY);
}
|
|
|
|
|
Hey guys. How to convert gdiplus::color to dword value?
Like this:
Gdiplus::Color(255, 0, 0, 0) -> 0xff000000
Gdiplus::Color(160, 48, 197, 253) -> ???
Thanks
011011010110000101100011011010000110100101101110
0110010101110011
|
|
|
|
|
The simplest way is to use Color::MakeARGB or Color::GetValue
Be careful if you try storing the ARGB in a COLORREF as it is possible to lose the alpha under certain circumstances and not all of your fellow programmers would approve. Also, be aware that when dealing with the bits, you sometimes need to switch the R and B around , depending on the context.
|
|
|
|
|
assuming all input values are in the [0,255] range, all it takes IMO is
(((((arg0<<8) | arg1) <<8) | arg2) <<8) | arg3
which is best implemented as an unsigned integer expression (otherwise it could give an overflow under some circumstances).
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
That is basically how MakeARGB is defined (and it provides for a common code base) so I'd still recommend it when they are already using GDI+...
typedef DWORD ARGB;
enum
{
AlphaShift = 24,
RedShift = 16,
GreenShift = 8,
BlueShift = 0
};
// Assemble A, R, G, B values into a 32-bit integer
static ARGB MakeARGB(IN BYTE a,
IN BYTE r,
IN BYTE g,
IN BYTE b)
{
return (((ARGB) (b) << BlueShift) |
((ARGB) (g) << GreenShift) |
((ARGB) (r) << RedShift) |
((ARGB) (a) << AlphaShift));
}
|
|
|
|