|
Hi,
Please suggest me any sample which is using Subclassing of CEdit class...
|
|
|
|
|
Here[^] you have a lot.
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Hi all,
How to prevent usage of global variables from other files.
thanks,
|
|
|
|
|
Check here[^]..
I hope it helps.
Regards,
Sandip.
|
|
|
|
|
I think you can declare the global variables as static so that the access is restricted to specific translation units.
|
|
|
|
|
You should use the static storage class: from MSDN [^]
When modifying a variable or function at file scope, the static keyword specifies that the variable or function has internal linkage (its name is not visible from outside the file in which it is declared).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
As people have already correctly answered you, using a static specification does this just fine.
If you are interested ( for culture maybe? ) there is another approach you may encounter. That is to put the variable definition in an anonymous namespace ( also known as an unnamed namespace[^] ).
|
|
|
|
|
Using VS2008, I've created an MFC TypeLib class, CApplication from _Application Interface in Ms Word 12.0 Object Library <8.4>. As expected, the class works with my Word 2007, but doesn't with Excel, PowerPoint etc.
My question, is there a way for me to create a CApplication class that caters to all the Ms Office family? I'm not looking at automating application specific functions, only common function (e.g: Save, Exit)
|
|
|
|
|
You cannot do it.
It's a COM interface and all applications have a different signture and functions.
So you need one per application and per version.
|
|
|
|
|
Too bad. I was hoping for an _Application interface that's being shared among all Office Apps (eg:_CommandBars). Does this mean I have to create individual dll for each Office App? I saw a few com addin that's available on my Word, Excel and PowerPoint. I don't think they have 3 separate dlls. Any idea how they are doing it?
|
|
|
|
|
Hi All,
I have created the menu.Can anybody tell me how to add icons to menu items?
Thanks,
Abinash
|
|
|
|
|
I think you have to create an owner-draw menu to add icons to it.
|
|
|
|
|
|
HI,
I had create a list control in dialog box. i wanna allow user enter the text when click on list. But now is read only. how can i do for it?
I'm waiting for your reply.thank you~
|
|
|
|
|
Are you referring to the LVM_EDITLABEL message? If so, make sure the list control has the LVS_EDITLABELS style.
"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
|
|
|
|
|
I think you need to create a CEdit control in the list item when use selected it.
Hide or destroy this CEdit control after this item loss focus.
|
|
|
|
|
Converted an older application to VS 2008, this is NOT a new application. This code has been used for years with no problems. Now when built with VS 2008 the CDialogBar is no longer visable but when I check the code (debugging) everything is going through the motions as if very thing is fine. So does anyone have any ideas?
TIA
IDD_HRULE_DIALOG DIALOG 0, 0, 511, 21
STYLE DS_SETFONT | WS_CHILD
FONT 8, "MS Sans Serif"
BEGIN
CONTROL "",IDC_HRULER,"Static",SS_WHITERECT | SS_NOTIFY | SS_SUNKEN,43,4,429,12
END
// just who is derived from whom
class CFrameWnd : public CWnd
class CMDIChildWnd : public CFrameWnd
class CChildFrame : public CMDIChildWnd
class CRuleHDlgBar : public CDialogBar
// create code
int CChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1)
return -1;
// create ruler dialog bars
if (!m_RuleHDlgBar.Create(this, IDD_HRULE_DIALOG,CBRS_TOP| CBRS_SIZE_FIXED,-1)
|| !m_RuleHDlgBar.InitDialog())
{
TRACE0("Failed to create dialog bar\n");
return -1; // fail to create
}
if (!m_RuleVDlgBar.Create(this, IDD_VRULE_DIALOG,CBRS_LEFT| CBRS_SIZE_FIXED|CBRS_ORIENT_VERT,-1)
|| !m_RuleVDlgBar.InitDialog())
{
TRACE0("Failed to create dialog bar\n");
return -1; // fail to create
}
Like I said, the actual code to draw, size the dialogbar executes fine.
Tony Teveris
Gerber Scientific Products
Senior Software Engineer
Phone: 860 648 8151
Fax: 860 648 8214
83 Gerber Road West
South Windsor, CT 06074
|
|
|
|
|
Hi,
I have used CComPtr class to declear two IStream type variable like below:
CComPtr<IStream> m_pStream;
CComPtr<IStream> m_pStream2;
and some where in my code I Create a stream on a file and let my m_pStream variable point at it like below:
::SHCreateStreamOnFileW(FileName,STGM_READWRITE | STGM_SHARE_DENY_WRITE,&pStream);
Now I want to do sth cause the first Stream variable "m_pStream" release the specified File, so I could create the stream on the same file and let my secound Stream variable m_pStream2 points at it like below:
::SHCreateStreamOnFileW(FileName,STGM_READWRITE | STGM_SHARE_DENY_WRITE,&pStream2);
because my Stream vars are defined with CComPtr class I coudn't use the Release method of my Stream variables.
even I have tested nullifying the first Stream variable but it didn't solve my problem.
What should I do?
|
|
|
|
|
use detach or different scope for the streams
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
would you please explain it more I couldn't find any thing. a little code would be useful
and there is no detach method
|
|
|
|
|
|
for m_pStream->Detach(); I got the following Error:
Error 1 error C2039: 'Detach' : is not a member of 'ATL::_NoAddRefReleaseOnCComPtr<T>'
Even I taype cast my CComPtr to CComPtrBase but again there were only to Member functions which both were in private scope!
|
|
|
|
|
Casting is absolutitly no solution for this problem!!!
use different scope for both variables
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Amir_m wrote: because my Stream vars are defined with CComPtr class I coudn't use the Release method of my Stream variables.
CComPtr has a Release[^] method. Use . ***NOT*** -> : pStream.Release();
Steve
|
|
|
|
|
of course I know But The Release Method of CComPtr Class is a private method and compiler does not let me to use it.
|
|
|
|