|
dipuks wrote: But if the USER is logged into machine as restricted USER without ADMIN privilages, then the GUI is not able to read registry contents.
Which indicates you are probably trying to read from the wrong hive. Settings common to all should go in HKLM, while user-specific settings should go in HKU.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hello friends,
I am building an MDI application. How do you make the application, main, frame, and any and all views initially displays themselves in their maximized state? Also, how do I make it so that while the user can resize the main application, they can't resize the (child) frames containing a particular view? When I try to modify the create struct (i.e. cs.dwExStyle &= WS_MAXIMIZE) to accomplish that (in every class that has a precreate function), it doesn't work. It seems to launch maximized temporarily, then automatically make it self smaller with out any user prompt.
Any help, as always, would be greatly appreciated.
Sincerely,
BP
|
|
|
|
|
Its may be because, In initinstance, there is call to ShowWindow,comment it, instead add WS_VISIBLE to window style in precreateWindow
Instead you can do this,
Let code in InitInstance be at it is,
In precreatewindow of main frame,add this line,
AfxGetApp()->m_nCmdShow=SW_SHOWMAXIMIZED;
And in child frame precreatewindow this code would be there,
cs.style |=WS_VISIBLE | WS_MAXIMIZE;
|
|
|
|
|
Thank you so much, you answered my question completely.
BP
|
|
|
|
|
Hello
In PPC, I wnat to open a picture viewer in my dialog. I call
pimg.exe and it open the picture viewer in \\My Documents\\My Pictures.
How could I open picture viewer in other path??
Thanks a lot!!
Any suggestion is useful!! Thanks!!
|
|
|
|
|
sdhtyjnniutnbjnhbghb wrote: open the picture viewer in \\My Documents\\My Pictures.
That should be the default path set somewhere in the application.
You can use a file dialog that the user sees on the click of the Browse button. Let the user select the path from the file dialog and then open the image.
See:CFileDialog
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Thanks a lot.
In PPC picture viewer, it already support a browser list to let user select the path. I want to auto select the path in the picture viewer in different condition. So I want to find a method to do it.
Any suggestion is useful!! Thanks!!
|
|
|
|
|
Can you be more specific.
|
|
|
|
|
Now I design a camera UI in PPC. when I press down the album button, it will go to the picture viewer. If the SD Card inserted, I wish the path in the picture viewer will change from \\My Documents\\My Pictures to \\SD Card. So I must find a method to change the path.
Thanks in advance;).
Any suggestion is useful!! Thanks!!
|
|
|
|
|
sdhtyjnniutnbjnhbghb wrote: I call
pimg.exe and it open the picture viewer in \\My Documents\\My Pictures.
How could I open picture viewer in other path??
Does pimg.exe support command-line arguments?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I search the megneto document.
One topic is as below:
Setting the Default Browse Directory
The command line executable pimg is used to specify the default browse directory. This is done by using the option -directory: followed by the name of the desired default directory:
pimg -directory:<directory_path>
But how can use that when the appilcation is running in O.S.??
Any suggestion is useful!! Thanks!!
|
|
|
|
|
sdhtyjnniutnbjnhbghb wrote: But how can use that...
Use either ShellExecute() or CreateProcess() .
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
How can I do that? I tried the function replace, but it doesn't work and I also tried to add \0 to a string before i Added \r\n to the text, but it's not working(Not sure why). I'm starting to run out of idea.
|
|
|
|
|
"This is a null terminated string\0"
You can use the strtok() functions to find \r\n, though it would help if we knew how you are creating the string
char *str = new char [10];
strcpy(str,"hello\r\n");
int x = strlen(str);
str[x-2] = '\0';
x = strlen(str);
delete[] str;
Works for me.
-- modified at 17:46 Sunday 27th August, 2006
|
|
|
|
|
I'm reading the string from a binary file and i replace the null at the end of each lines by \r\n for display purpose in an editbox. After I'm taking the text from the editbox and I want to put it back into the binary file.
here is what i currently have to write it.
The vars:
CFile fVampFile;
String * strInfo = "";
char * cInfo = "";
int iEnd;
The code:
strInfo = eSpeech->Text;
strInfo->Replace("\r\n","\0");
cInfo = (char*)Marshal::StringToHGlobalAnsi(strInfo).ToPointer();
iEnd = strlen(cInfo);
fVampFile.Write(cInfo,iEnd);
-- modified at 17:58 Sunday 27th August, 2006
I forgot to mention this, but the string can have 3 /r/n in it at different places, because each string can have up to 3 sentences in it and all 3 need to end with null.
and the code you gave me removes the /r/n but null isn't added.
|
|
|
|
|
Is thst String a CString or a basic_string ? The CString class has a TrimRight() member that you might want to try.
|
|
|
|
|
It won't work, because i can have up to 3 /r/n in the string.
Also do you know if CFile.write will write the null to the file? I was wondering if it could be the reason why I can't add a null to a string.
|
|
|
|
|
This function should write everything, but the terminating '\0' is not included in string length.
So try fVampFile.Write(cInfo,iEnd + 1);
|
|
|
|
|
samkook wrote: It won't work, because i can have up to 3 /r/n in the string.
Which means you should be using strtok() and not strlen() .
samkook wrote: Also do you know if CFile.write will write the null to the file? I was wondering if it could be the reason why I can't add a null to a string.
CFile , and its methods, has no bearing on how you manipulate a string.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
samkook wrote: strInfo->Replace("\r\n","\0");
This obviously will not work. You can't use string-related functions, which expect nul-terminated strings, to add/find/replace a nul character. Doing do effectively results in nothing happening.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
One way to do it. It removes any number of trailing CR and/or LF combinations:
<br />
char str[20];
int index;<br />
<br />
strcpy(str, "hello\r\n");<br />
index = strlen(str);<br />
<br />
if(index) {<br />
index--;<br />
for(; index >= 0; index--) {<br />
if(str[index] == '\r' || str[index] == '\n') str[index] = '\0';<br />
else break;<br />
}<br />
}<br />
<br />
<br />
Else, you can use a CString or str
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
Thanks everyone for all your help, I now have everything to solve this problem. Finally, I will separate the sentences, because it will be simpler and thanks fefe for pointing to me that null wasn't included in the string length.
And one last thing, the code you gave me kakan ended with only null written in the file, i'm not sure what was wrong. Also if I understand correctly, it will write two null at the end of each sentence and it's very important that it be only one.
And sorry if there are thing that doesn't make sence in my post, i'm really tired and english is not my first language.
|
|
|
|
|
Hello.
I just debugged the code I gave you and it works as it should.
It removes any CR LF combinations from the end of the string.
The result is stored in str (assuming you do not delete the string before writing it to the file!).
My code will replace all terminating CR and LF with nulls in the buffer, that's right. But when you later uses the resulting buffer, it's the first null char that counts. Simply because a null char is seen as a string terminator.
If you want the length of the resulting string, just use strlen() (or it's variants).
PS.
English isn't my native lingo either.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
Hello All,
I have a question. I am about to create some software. I plan on using MFC MDI with two form views. My question regards sizing it so that it looks appropriate on different screens since users tend to have different screen resolutions. What is the best strategy to ensure that my software shows up properly on different screen settings? How can I make the contents of my form view (and any view for that matter) scale properly within limits?
Any help you can provide would be very helpful.
|
|
|
|
|
You should take a look at the GetDeviceCaps() function which will give you the sizes you need to know about for the screen. A common method of creating a correct sized window is to scale it according to the size of the font used.
|
|
|
|