|
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!![Confused | :confused:](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_confused.gif)
|
|
|
|
|
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.
|
|
|
|
|
Amir_m wrote: of course I know But The Release Method of CComPtr Class is a private method and compiler does not let me to use it.
No, it's not private. The following compiles fine:
CComPtr<IStream> spStream;
spStream.Release();
Steve
|
|
|
|
|
May be you can try as follows:
void Foo()
{
{
CComPtr<IStream> m_pStream;
::SHCreateStreamOnFileW(...);
}
{
CComPtr<IStream> m_pStream2;
::SHCreateStreamOnFileW(...);
}
}
|
|
|
|
|
My Problem is accessing the file because the Stream Created previously doesn't release the file I can't access the file with another stream (even nullifying that stream doesn't cause it to release the file)
|
|
|
|
|
In the code segment in my previour post, m_pStream and m_pStream2 are in different scopes (between {}), so the streams will be closed automatically when the scope ends. So, both calls to SHCreateStreamOnFile(...) will be successfull.
|
|
|
|
|
Dear All,
I have developed an application in MFC and it is working fine and creating directories and file in the program files directory when the program is run as administrator. But when the program is run as limited user account, the program cannot write any files in the program files directory.
The same application developed in JAVA seems to be working fine in both Admin user and limited user. When I googled, all articles recommends to create the files under Application Data for all users. But, for me changing this will be a huge task. Is there any other alternative to grant access to the limitied account user from my application.
Many thanks in advance.
Bhanu
|
|
|
|
|
bhanu_8509 wrote: The same application developed in JAVA seems to be working fine in both Admin user and limited user.
So, why don't you use that one (just kidding...)?
This may be useful [^].
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]
|
|
|
|