|
I have a program with some ini profile files. For dynamicly changing profile files when the app is running, i change the m_pszProfileName value which is a attribute of the App Class. But some problems bother me, the values are loaded correctly for each ini file when the app first running, while it does'nt work after i changed the m_pszProfileName value when the app run.
Can anybody help me?
Thanks.
<br />
void update()<br />
{<br />
....<br />
<br />
free((void*)m_pszRegistryKey);<br />
m_pszRegistryKey = NULL;<br />
free((void*)m_pszProfileName); <br />
m_pszProfileName =_tcsdup(szPath); <br />
....}<br />
...<br />
{<br />
AfxGetApp()->GetProfileString(......);<br />
}<br />
...<br />
hi
|
|
|
|
|
You can check in sources what is wrong there (maybe it caches open file handle), but why don't you use GetPrivateProfilexxx functions directly?
Igor Green
http://www.grigsoft.com/ - files and folders comparison tools
|
|
|
|
|
|
zt9788 wrote: But some problems bother me, the values are loaded correctly for each ini file when the app first running, while it does'nt work after i changed the m_pszProfileName value when the app run.
try these INI file reading wrapper class:-
INI FILE reader![^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
There is a statement in the description of the CArray in MSDN:
……
If you need a dump of individual elements in an array, you must set the depth of the CDumpContext object to 1 or greater.
………
What dose “the depth of the CDumpContext object” means? I can’t understand.
|
|
|
|
|
I see from msdn that the generic mapping of atof() is _tstof(), but I can't use it even after I include <stdlib.h> & <stdio.h>. So, which .h file should I include?
MSDN:
TCHAR.H routine _UNICODE & _MBCS not defined _MBCS defined _UNICODE defined
_tstof atof atof _wtof
-- modified at 21:20 Wednesday 17th May, 2006
|
|
|
|
|
|
It's very strange that I can use _tstof() in VS.net 2003 but not VC6, even I include the file tchar.h.
Maybe I need the latest Platform SDK?
|
|
|
|
|
Hi,
On Windows Xp, there is a functionality that allows to copy the archives of an user. This functionality is had access through My Computer ( click of the right button of mouse ) -> Settings -> Advanced -> User Profiles -> Configurations -> Copy to.
How can I do that by C++ programming? I was thinking in something like a method of a WMI Class or the ShellExecute command.
Can you help me?
Grateful!
Hélio
|
|
|
|
|
I don't know what you are trying to do.
SHGetSpecialFolderLocation[^]
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
I just want to copy the files of a user profile to another directory.
Here is a example:
There is user called João. In the directory c:\documents and settings\João\ are the João user's files. I just want to copy them to another directory. This functionality, as i said, is had access by My Computer -> Properties -> Advanced -> User Profiles -> Settings -> Copy To, but i want do that by C++ programming.
I still watting for help!!
gratiful!
Hélio
|
|
|
|
|
Hello all..
for the following program I got headache about the switch statment:
if I use switch(*hello) I got a compile error : switch quantity not an integer!
if I remove the stat I got a runtime error: segmentation fault!
I need help to fix this problem..
#include <stdio.h>
main()
{
int *hello;
printf("Hi, Enter any value > ");
scanf("%d",&hello);
switch (hello)
{
case 1: printf("your 1 luck number is > %d\n",hello);
case 2: printf("your 2 luck number is > %d\n",hello);
case 3: printf("your 3 luck number is > %d\n",hello);
default: printf("your 4 luck number is > %d\n",hello);
}
}
thanks
Ajmi
|
|
|
|
|
did you try changing the declaration of hello to be:
int hello;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc.</A>
|
|
|
|
|
The segmentation fault is because the scanf statement is writing a new value to the POINTER hello , setting it to the value entered by the user. So if the user enters "4", hello is now a pointer to "address" 4. This will crash.
Do this instead:
<br />
int hello;<br />
printf("Hi, Enter any value > ");<br />
scanf("%d", &hello);<br />
switch(hello)<br />
{<br />
...<br />
...<br />
}<br />
Bob Ciora
|
|
|
|
|
moloza wrote: int *hello;
int hello is enough
nave
|
|
|
|
|
Thanks all
but I need hello to be a pointer because it might be passed as an argument to some function (like in case of use 'recv' in socket programing) in the program.
Actually I submet a very simple program but what if the program read hello from the keyboard and send it to another side in a socket connection, ofcourse, I will need hello to be a pointer.
so the change must be somewhere in the program rather than the decleration of hello.
but where?!!
thanks again
Moloza
Ajmi
|
|
|
|
|
modify like this..
main()
{
int *hello = new int;
printf("Hi, Enter any value > ");
scanf("%d",hello);
switch (*hello)
{
case 1: printf("your 1 luck number is > %d\n",hello);
case 2: printf("your 2 luck number is > %d\n",hello);
case 3: printf("your 3 luck number is > %d\n",hello);
default: printf("your 4 luck number is > %d\n",hello);
}
}
nave
|
|
|
|
|
If you need a pointer to hello, you can get one by writing &hello .
|
|
|
|
|
moloza wrote: int *hello;printf("Hi, Enter any value > ");scanf("%d",&hello);switch (hello)
if you still want to use pointers in your code, you see this example
#include<stdio.h>
#include <malloc.h>
main()
{
int *hello;
printf("Hi, Enter any value > ");
hello=(int*)malloc(sizeof(int));
scanf("%d",hello);
switch (*hello)
{
case 1: printf("your 1 luck number is > %d\n",*hello); break;
case 2: printf("your 2 luck number is > %d\n",*hello);break;
case 3: printf("your 3 luck number is > %d\n",*hello);break;
default: printf("your 4 luck number is > %d\n",*hello);
}
}
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Thanks for ALL
ITS working now>>
CHEERS
Ajmi
|
|
|
|
|
moloza wrote: ITS working now>>
you are always welcome!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hi,
I have an application residing on a server that multiple users can run from their own PC's. I would like any one instance of the application to be able to notify all other instances that a data file has been updated, ideally, providing information regarding the record that has changed.
I cant use a client/server approach as the server is (for us anyway) simply storage space, I cant run applications on there.
Im not sure if a Mutex would work here as each person is running the app in their own address space. TCP/IP messages might work but with dynamic IP addresses, this might prove difficult.
Anyone have any suggestions? I could be missing the obvoius here!
TIA
Tony
|
|
|
|
|
Sounds like you need what is called "true peer to peer" networking. The key would be how to handle discovery. I have no idea how true p2p does that.
What they call p2p hybrid networks use servers to assist in the discovery process. This does not appear to be an option for you.
Perhaps using UDP for discovery is possible.
If you have a firewall in the network that only allows port 80 then I think you are hosed.
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
You could play with file locking.
Lock various regions of a file on that server -- to denote things.
Personally, I prefer the tcp-ip method. It may be a little work to get going, but it's the richest solution.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc.</A>
|
|
|
|
|
Since the application binary resides on a server you could place a COM object on the same server to manage updates. The application would still run on the client but all running instances would communicate (using DCOM) with an update component which runs on the server. The update component would inform its clients of changes using connection points.
Steve
|
|
|
|