|
hraman1987 wrote: I am having a UI thread...
There's really no such thing. Do you mean a thread with a message pump?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
DavidCrow wrote: There's really no such thing. Do you mean a thread with a message pump?
Hehe... I've always had the same sentiment. Whoever gave that name to it was probably drunk.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Thanks a lot your suggestions were helpful , i have changed to worker thread and its working fine
|
|
|
|
|
You're welcome. You can mark the helpful replies by clicking "Good Answer".
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
hai everybody,
please anyone tell me How to create a MS ACESS database file and add table on it during run time in a dialog based application using VC++ 6.0 ......?
thank u........
|
|
|
|
|
Hi,
The project I'm working on requires to open a bitmap image from a location, display it and then save the image at another location. In this project I use a variable in OnFileSave As Dlg as OPENFILENAME type.
But, I have already used the same variable during file open dialog as a CString type.
The problem is: I need to use the same variable for both the dialogs.
Plzz suggest a variable type that has the features of both CString and OPENFILENAME or any other alternate solution.
Thank you in advance.
|
|
|
|
|
raviteja2020 wrote: The project I'm working on requires to open a bitmap image from a location, display it and then save the image at another location.
That's fine: your requirements are clear.
raviteja2020 wrote: In this project I use a variable in OnFileSave As Dlg as OPENFILENAME type.
What does it mean, exactly?
raviteja2020 wrote: But, I have already used the same variable during file open dialog as a CString type.
You...What?
raviteja2020 wrote: The problem is: I need to use the same variable for both the dialogs.
Usually this can be done.
raviteja2020 wrote: Plzz suggest a variable type that has the features of both CString and OPENFILENAME or any other alternate solution.
I would go with the 'alternate solution'. Anyway you should give us meaningful details.
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]
|
|
|
|
|
CPallini wrote:
raviteja2020 wrote:
In this project I use a variable in OnFileSave As Dlg as OPENFILENAME type.
What does it mean, exactly?
I used a variable named m_imgName in the OnFileSaveAs() Dialog. the variable is of type OPENFILENAME.
CPallini wrote:
raviteja2020 wrote:
But, I have already used the same variable during file open dialog as a CString type.
You...What?
I have used same variable name in another dialog OnFileOpen(). In this dialog the variable is of type CString.
Now the problem is, I would like to declare a public variable so that it can do the work of both the variable types.
So I need a variable type as a combination of CString and OPENFILENAME.
|
|
|
|
|
raviteja2020 wrote: Now the problem is, I would like to declare a public variable so that it can do the work of both the variable types.
So I need a variable type as a combination of CString and OPENFILENAME.
Nope. You don't need that. You may share, for instance, the CString object (and make it interact properly with the OPENFILENAME struct ).
Could you please post the relevant code?
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]
|
|
|
|
|
Initial declaration of the variable:
CString m_imgName;
Using the variables in both dialogs
<pre>
void CSockDlg::OnFileOpen()
{
CFileDialog m_ldFile(TRUE, m_imgName, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFilter);
if (m_ldFile.DoModal() == IDOK)
{
m_imgName = m_ldFile.GetFileName();
UpdateData(FALSE);
}
}
void CSockDlg::OnFileSaveAs(HWND hWnd)
{
OPENFILENAME m_imgName;
TCHAR szPath[MAX_PATH];
TCHAR szFile[MAX_PATH];
ZeroMemory( &m_imgName, sizeof(OPENFILENAME) );
m_imgName.lStructSize = sizeof(OPENFILENAME);
szFile[0] = '\0';
m_imgName.hwndOwner = hWnd;
m_imgName.lpstrFile = szFile;
m_imgName.nMaxFile = sizeof(szFile)/sizeof(*szFile);
if (1)
{
m_imgName.lpstrInitialDir = szPath;
}
if ( GetSaveFileName( &m_imgName ) == TRUE )
{
}
else
{
}
}
</pre>
Here I've declared the variable again in th OnFileSaveAs() so that my project runs temporarily.
I'll have to remove the declaration from the dialog and have to declare a public variable.
Thank you
|
|
|
|
|
I cannot quite figure out what you are trying to achieve here but you cannot use a single variable as two different types. If you need to share some information that is held in the OPENFILENAME structure, then just make that structure the public variable.
|
|
|
|
|
void CSockDlg::OnFileSaveAs(HWND hWnd)
{
OPENFILENAME ofn;
TCHAR szPath[MAX_PATH];
TCHAR szFile[MAX_PATH];
ZeroMemory( &ofn, sizeof(ofn) );
m_imgName.lStructSize = sizeof(ofn);
szFile[0] = '\0';
ofn.hwndOwner = hWnd;
ofn.lpstrFile = szFile;
ofn.nMaxFile = sizeof(szFile)/sizeof(szFile[0]);
ofn.lpstrInitialDir = szPath;
if ( GetSaveFileName( &ofn ) == TRUE )
{
}
else
{
}
}
raviteja2020 wrote: Here I've declared the variable again in th OnFileSaveAs() so that my project runs temporarily.
I'll have to remove the declaration from the dialog and have to declare a public variable.
Variable m_imgName doesn't need to be declared public (needs to be a class member, not a local variable), as it is used in its owner class code.
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]
|
|
|
|
|
raviteja2020 wrote: same variable
Same variable? Or same variable name? Illustrate what you mean with code, please.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
At first learn to clearly describe the problem. This is really often half of the solution.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Why are you using a CFileDialog object for opening and GetSaveFileName() for saving?
As far as your question goes, consider:
int x = 5;
void main( void )
{
int x = 10;
cout << x;
}
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Anyone know the code for creating a file using CreateFile(), Writing the listbox contents into the file using WriteFile() and reading the contents of the file into a listbox using ReadFile() ?
|
|
|
|
|
|
You can find your answer in MSDN.
|
|
|
|
|
I need code urgently. Pls help.
|
|
|
|
|
ratprita wrote: I need code urgently.
BTW: its a quite simple task and you're a developer, aren't you? The documentation is your best friend.
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]
|
|
|
|
|
ratprita wrote: I need code urgently.
Then why not go and look for it? It's all here[^].
|
|
|
|
|
Yes.
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 are fullfilling most conditions of bad questioning in forums.
tip: listbox <-> string <-> file
Do your homework by reading the docs (aka RTFM)
SCNR
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
A list box or an edit box? A list box is not some sort of a "text container" that you can dump text into. So, you'll have to do a bit of work (parse entries and add it to the list box).
I'm sure all those functions are documented and there are plenty of examples out there. Not to mention if you're using MFC, things will be easier.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|