|
No but how is it different from CreateProcess? There seems to be no parameters that specify it as read-only.
|
|
|
|
|
I see, you are trying to open with word and not with your own program for reading. What you want to do will probably need to use word OLE automation. I would suggest doing some searching for just that, it's not as simple as just executing the program to do this. It's actually not much more code but understanding the concepts is a bit more complex. I haven't done this sort of thing in a long time so I don't know the code off hand, but I'm sure a quick google search will find something.
-- Rocky Dean Pulley
|
|
|
|
|
I found a simpler way. Before opening up the document in Word, I used GetFileAttributes() to get its file attribute. If the returned value is not read-only, I called SetFileAttributes to set it so and then use CreateProcess to open it up within Word. Much simpler. Thanks for your help though.
|
|
|
|
|
Assuming that you meant CreateFile, pass the second parameter as GENERIC_READ.
-- Rocky Dean Pulley
|
|
|
|
|
CFile SrcFile;
CString SrcFileName="C:\\test.doc";
SrcFile.Open(SrcFileName,CFile::modeRead ,NULL);
|
|
|
|
|
I do not want to read the contents of the file. I want to be able to open the file in Microsoft Word or Notepad as read-only.
|
|
|
|
|
How can I declare a pointer pointing to the mainframe in view.cpp ?
(I want to use the mainframe object in view.cpp)
Thanks!
|
|
|
|
|
add a frame pointer member in your views,
so the MainFrame passes the this pointer (itself actually) to the child view that have now a pointer to its mainframe...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Anonymous wrote:
How can I declare a pointer pointing to the mainframe in view.cpp ?
In the view's .h file, just add a member variable of whatever type your frame is (e.g., CMainFrame ). To define and use that member variable, try AfxGetMainWnd() or GetParentFrame() .
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
what does this mean?
struct abc {
int (*loop)();
}
int Off()
{
return 1;
}
abc->&Off;
i don't understand this sourcecode!
Thx for explaination!
|
|
|
|
|
abc is a structure that holds a pointer to a function which takes no arguments and returns an int. it's also missing a semicolon at the end.
i'm not sure what that last line is.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
<font color=blue>int</font> (*loop)(); this defines a pointer to function.
it means that abc structure is looking for its loop member any function that has the same signature (no parameters, and an int as returning value).
abc->&Off; this is not correct for me, as abc is a type (and so, not an instance of that struct) and loop is not static so we cannot directly apply to it the operator -> .
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
i forget some code to post here. abs is an instance of struct abc. doesn't make sense i just want to cut it someway.
abc->Loop = &Off();
what does this mean? has Loop the value 1?
|
|
|
|
|
ok, let's say that abc is an instance of the abc structure here (even if in theory, the compiler won't allow you to give it the same name as its type - it is not VB ! )
abd->Loop refers to the member Loop we talked about previously. actualy, if we use the operator -> , abc in a pointer to an instance of abc structure , otherwise we would have used the operator .
now, as Loop excpects a pointer to function, we have to pass it the adress of a function that have the same signature (no parameters, return an int).
that's what the function Off() looks to be.
so we use the "address of" operator & to pass the address of the Off() function into abc::Loop...
understood ?!
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
thats all clear. thx i am not a noob but lazy to type :P
but i don't understand why the author wants the address of method Loop();
the return value would make sense in any way but the address ...
hm... thx for your time.
|
|
|
|
|
zuschauer1980 wrote:
hm... thx for your time.
no problem, i'm here your servant sire :->
i'd like to add a detail however.
we use such function to have a "changing behavior".
if you know a little about virtual functions on C++, or Delegates in VB, it is quite the same.
it permits you for a same call to use different functions.
for example :
<font color=blue>int</font> iVal = 0;
<font color=blue>int</font> Func1() {
<font color=blue>return</font> 1;
}
<font color=blue>int</font> Func2() {
<font color=blue>return</font> 2;
}
abc TmpAbc;
TmpAbc.Loop = &Func1;
iVal = TmpAbc.Loop(); <font color=green>
TmpAbc.Loop = &Func2;
iVal = TmpAbc.Loop(); <font color=green>
hope this help more now...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
ah like delegates. ok everything is clear. i know c#.
thx for your help.
regards!
|
|
|
|
|
|
it is all about managed code not modular one, u know?
|
|
|
|
|
Almost every program I have worked on uses some technqiue to convert enumberated values to strings (and vice-versa). I suspect I have seen a dozen or more different techniques when multi-language translation is factored in. I am curious to what preferences other developers have and any pros/cons they see with those techniques.
|
|
|
|
|
|
Sorry to be vague. Was wondering what generic techniques you use/recommend for implementing conversions between enumberated type values and string representations. Also curious how (of if) you would use a different technique for multi-language support/translation.
|
|
|
|
|
I created a class called EnumStringMap which maps enums to CString s and/or resource ids. The includes some handy-dandy helper methods that allow it to be used with a CComboBox . Unfortunately I can't post it because it's code written for work.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
TRY
CMap with integer as a KEY!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Does anyone know how to send HTML directly to the printer? I need to do this programmatically. I'm creating HTML files on the fly, and I'm able to display them properly using Internet Explorer. This provides sort of a "Print Preview" mechanism, but I can find no way automatically print it. It would be great if iexplore.exe had a command line option to print the document without bringing up the IE screen.
I've tried some sharewares that claim to do this, but the formatting is never correct. It seems like I need to get this to work with IE somehow.
Any suggestions are greatly appreciated.
|
|
|
|