|
Could you be more specific ? At which time exactly do you need to call your function ? What does 'at the start of the application' mean ? Before you enter the main ?
If this is the case, you can use a little trick: use static variables in order to call your function. Static variables are evaluated at the startup of your program (before main gets executed). So, doing something like that:
static int Value = MyFunction();
Lets you call MyFunction before main gets called. Of course it needs to return an integer.
|
|
|
|
|
Thanx a lot from me for this trick!
Only one question, in dialog based projects, where is the best place to create this,
in application class??
regards
break;
|
|
|
|
|
Did you understand my post ? Because it doesn't look like... A static variable in this case will need to be global of course. Otherwise it won't work (cause if it is local to a function, it is evaluated only the first time the function is entered).
Do you really need to do this before the main gets executed ? Won't it work if you put the code in OnInitDialog ? What do you need to do exactly ?
|
|
|
|
|
Cedric Moonen wrote: Static variables are evaluated at the startup of your program (before main gets executed).
As are global objects in general.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
In the title you say "at the time of start the application", and in the content - "at the time of first object creation"; they are not the same...
Keep a static class variable of type bool and check whether it is false in the constructor. If so, the first object is being created (now set it true), otherwise - not the first one.
--
======
Arman
|
|
|
|
|
Hi,
I am trying to execute .Net 2005 executable in Test PC.It's not executing and giving an error message "The application has failed to start because the application configuration is incorrect. re-install the application and fix the problem"
Do we need to install any framework or service packs in Test PC? Please help me.
thanks & regards,
Narasimharao
knarasimharao
|
|
|
|
|
K. narasimharao wrote: Do we need to install any framework or service packs in Test PC
I think so. You should install at least Framework 2.0 redistributable package
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Dire Straits
|
|
|
|
|
I want to apply security attributes for my application so that it cannot be killed from Task Manager. So how to use security attributes to CreateProcess function.
Thanks in advance
--
======
Arman
|
|
|
|
|
Hi All,
I am useing EVC++ 4 for PocketPC.
Can I use CDialog in CPropertyPage?
regards,
Divyang Mithaiwala
|
|
|
|
|
Divyang Mithaiwala wrote: Can I use CDialog in CPropertyPage?
CPropertyPage is derived from CDialog .
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
We have converted .net 2003 application(developed in vc++.net) to .net 2005. But the exe built in .net 2005 is not executing in .net 2003 environment. It is showing error that "initialization required to execute this application and rebuilding the application will fix problem".
To execute that .net 2005 exe under .net 2003 environment do we need to have any frame work or service packs?
Thanks in Advance
|
|
|
|
|
You need to rebuild that application in .net 2003 environment, as error says.
|
|
|
|
|
Actually that application is developed in .net 2003 and we are converting that in to .net 2005 framework . Now I am executing the exe in .net 2003 environment that is built from .net 2005. This is giving error that "he application is configuration is incorrect".
Even for a small test application developed in .net 2005 and while executing under .net 2003 in seperate test PC is also giving same error.
|
|
|
|
|
Those test machines need .Net framework 2.0 installed.
|
|
|
|
|
how to create Transparent Bitmaps using win32
|
|
|
|
|
|
I am writing a program that will delete file(s) in a specified folder except file(s) in used.
Please show me how to check whether a file is using or not.
(Use C/C++ Non-MFC)
Thanks a lot
Sincerely
Thangnvhl
|
|
|
|
|
may be:
HANDLE hFile = CreateFile("test.txt",GENERIC_WRITE,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL ,NULL);
if(hFile == INVALID_HANDLE_VALUE){
if(GetLastError() == 5 || GetLastError() == 4)
{
//this file is being used
}
}else
{
CloseHandle(hFile);
}
|
|
|
|
|
aldo hexosa wrote: if(GetLastError() == 5 || GetLastError() == 4)
Why use constants? It would be much more readable to use:
if (GetLastError() == ERROR_TOO_MANY_OPEN_FILES || GetLastError() == ERROR_ACCESS_DENIED)
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
an alternative way i think is to use the OF_SHARE_EXCLUSIVE flag as the third argument for the OpenFile() function.
May all beings be happy and free...
|
|
|
|
|
Hi, Expert,
Now I'm implementing a encrypt software, all file is encrypted in a folder,
But when user wanna excute the file, I need decrypt the file and use CreateFile and WriteFile function copy it to a temp file. Then use ShellExecute let user can excute the file. when user edit and save the temp one, I'll encrypt back to the origin encrypt file.
Now my problem is, After user close the file, I need delete the temp one, because all it's content is not encrypt.
I search long time on internet, Can't use "open exclusive" to check is the file opened, because it can't detect notepad or ultraedit, also can't search the window's title to check have the file name or not, because some program may not show file name on window's title.
I found CreateFile have a param FILE_FLAG_DELETE_ON_CLOSE, but can't figure out how to solve my problem, or can you provide any other solution? Thanks!!
|
|
|
|
|
Check the following APIs
FindFirstChangeNotification(....)
ReadDirectoryChangesW(....)
that may help you
RinuRaj
|
|
|
|
|
rockryan wrote: Can't use "open exclusive" to check is the file opened, because it can't detect notepad or ultraedit
I'm not sure about notepad, but when UltrEdit opens a files it first creates a snapshot, reads the file, then closes the handle. I.e. It makes a copy of the file first and uses this copy for all it's read and write operations. If you are creating encrypted files, it is generally a bad idea to write anything unencrypted back to the HD.
|
|
|
|
|
does anyone know how to clear view in SDI form ?
thanx alot
|
|
|
|
|
What does this mean? Do you want to content drawn on view?
|
|
|
|