|
Can you please explain me with any example.
thnks alot.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
"_$h@nky_" wrote: Can you please explain me with any example.
No.
This is mainly a design issue, for which I have suggested a solution.
How to implement this design is for you to figure out, which shouldn't be too hard.
If you have more specific questions in the nature of "how do I tell my main thread when the computation has finished", I'll be glad to answer them. But serving it on a silver plate would prevent you from learning and besides I don't have the time to do it.
To give you an idea I suggest you read this article[^] regarding worker threads. It's the best in my opinion.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
hi <your name="">, maybe you might not be conversant with threads or multithreading, which simply means, having many threads running at the same time, in one program, so am going to easily illustrate how you can overcome your problem using just one thread.
i advice you place your code for filling the list in a function then you call the function in the Oninitupdate or since you want the list loaded at progream start. this is better and clearer than filling so much code in the oninitUpdate() fiuntion.
so this is what we shall do, i hope you can tell the number of items you are putting in the list,
Put a progress control ,
Add a control variable to it, call it "m_ctlProgress" using the wizard.
//////////////////////
int nCounter = 0;
int nNumberOfRecords = <your number="" of="" records="">
ctlProgress.SetRange(0,nNumberOfRecords );
for <loop trough="" your="" data="" as="" you="" fill="" list="">
{
//////////////////////////
Your filling code here
/////////////////////////
nCounter++;
m_ctlProgress.SetPos(nCounter);
}
then call the function from wherever, from the Oninit.. or when a certain button is clicked, etc
|
|
|
|
|
Some hints...:
- You replied to the wrong person.
- The function you're referring to is
OnInitialUpdate() , nothing else. OnInitialUpdate() is called before the view is displayed, which means that your progress bar probably won't even show if your code is called from OnInitialUpdate() .- You have not formatted your code using <pre></pre> tags, which makes it hard to read.
- At best, the user will still experience a non-responsive application even if your advice is followed.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Hi all,
I am working on VC-2008, my problem is i have made a .h file and had defined some variables in it. And in other files i have used those global variables using extern. Now, when i compile the program its giving an error error LNK2001: unresolved external symbol "char Platform" (?Platform@@3DA), and if i include that .h file as header file it gives error variables already defined....
How can i do this??
Thanks in advance
|
|
|
|
|
(1) You should declare global variables as extern in a (shared) header (.h ) file.
(2) You should define global variables inside one source (.cpp ) file.
For instance:
(MyCommonHeader.h)
extern int goo;
(MyMainSource.cpp)
#include "MyCommonHeader.h"
int goo;
(MyOtherSource.cpp)
#include "MyCommonHeader.h"
BTW: You shouldn't use global variables.
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]
|
|
|
|
|
You can declare the variables as extern in the header file, and define them in any of cpp file.
|
|
|
|
|
hi,
how to show dialog box in maximized mode after running the dailog application? when dialog based app is ran then dialog will be in restroed down size, may i know how to dislpay dialog in maximized size.
thanks in advance.
|
|
|
|
|
Use
ShowWindow(SW_MAXIMIZE);
I hope it helps.
Regards,
Sandip.
|
|
|
|
|
I have used this code to delete files from the current directory. But it not works.
Actually i cant use the full path. As because i dont know where my software will install. It may be D:\\or else also
SHFILEOPSTRUCT sfo;
sfo.pTo = NULL;
sfo.hwnd = NULL;
sfo.wFunc = FO_DELETE;
sfo.pFrom = "..\\Test\\*.txt\0";
sfo.fFlags = FOF_FILESONLY | FOF_NOERRORUI | FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI;
SHFileOperation(&sfo);
modified on Thursday, October 23, 2008 2:55 AM
|
|
|
|
|
You better use a complete path like "C:\\...\\*.txt
Greetings from Germany
|
|
|
|
|
Actually i cant use the full path. As because i dont know where my software will install. It may be D:\\or else also
|
|
|
|
|
Dont write files in the installation directory. Vista will knock you out!!!
Use a user path:
-> SHGetFolderPath
-> GetCurrentDirectory
-> write some path information in the registry (in the setup)
Greetings from Germany
|
|
|
|
|
Sk Mohiuddin wrote: sfo.pFrom = "..\\Test\\*.txt\0";
Documentation says:
pFrom
A pointer to one or more source file names. These names should be fully-qualified paths to prevent unexpected results.
I hope it helps.
BTW: You can use GetModuleFileName[^] to get the path of your executable.
Regards,
Sandip.
|
|
|
|
|
SEE MY CODE BELOW:
Ive got a dialog box where i enter Contact Details......
Ive To Insert IT Into Access Database........
//Take the values entered in edit box to CEdit *
m_First.GetWindowText(Firstname);
m_Last.GetWindowText(Lastname);
m_Add.GetWindowText(Address);
CString FullName = "INSERT INTO Contacts (FirstName, LastName, Address) VALUES ('" +Firstname+ "', '" +Lastname+"','" + Address+"'))";
executeSQL((SQLCHAR *) FullName);
ERROR :
CANNOT CONVERT CString to SQLCHAR*
|
|
|
|
|
anna mathew wrote: CANNOT CONVERT CString to SQLCHAR*
What the hell is an SQLCHAR* anyways?
anna mathew wrote: executeSQL((SQLCHAR *) FullName);
Why can't you just do it with the CString variable itself?
ExecuteSQL(FullName);
Why the wrong spelling (executeSQL instead of ExecuteSQL)? Is that a separate function you wrote?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Rajesh R Subramanian wrote: What the hell is an SQLCHAR* anyways?
Is is a ODBC API's data type:
typedef unsigned char SQLCHAR;
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]
|
|
|
|
|
Looks like MSDN doesn't know it but...
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Sure [^]?
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]
|
|
|
|
|
Touché!
I just did a search on MSDN, but the results were of no avail to reveal this secret datatype.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
thank you....
i tried it..but a new error comes up
error C2594: 'static_cast' : ambiguous conversions from 'void (__thiscall CInsert::* )(void)' to 'AFX_PMSG'
|
|
|
|
|
anna mathew wrote: i tried it..but a new error comes up
You tried what? Why don't you just show the code and be precise in asking questions? Do we need to ask you 10 questions just to get to know your exact problem?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Rajesh R Subramanian wrote: You tried what? Why don't you just show the code and be precise in asking questions? Do we need to ask you 10 questions just to get to know your exact problem?
Ya sir, but plz plz help, u r aware: your signature says it all
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]
|
|
|
|
|
I haven't understood yet if you're calling a CDatabase method or not, because I cannot find a ExecuteSQL function in ODBC API .
If you're using MFC to do database access then you don't need SQLCHAR data type.
Could you please post a more complete code snippet (don't forget to format it using 'code block' button)?
Could you you please explain better the scenario and your requirements?
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]
|
|
|
|
|
look what a SQLCHAR* is i guess SQLCHAR[] make one and copy the CString to it.
Greetings from Germany
|
|
|
|