|
Read about:
GetStartPosition and GetNextPathName
hint: u get a position from the first, u put it into the other!
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
You have to use GetStartPosition() and GetNextPathName() to iterate through the list of files.
If a train station is where the train stops, what's a workstation...?
|
|
|
|
|
I got misled by MSDN (my fault)....thanks for pointing me in the right direction...
Thanks,
ns
|
|
|
|
|
i need to show text in my status bar to show a process working and what is happening.
the problem is i have no idle time to update the status bar.
how can i update the status bar without stopping my code?. (or can i?)
|
|
|
|
|
If you have no time to update your status bar, you have a more underlying problem with cpu usage. your app is going to be totally unresponsive. If someone obscures it with another window, and then hides that window, your app is not going to redraw.
This creates a poor user experience and they'll think your app has crashed.
Consider putting your intensive code in a worker thread, and leave the main thread free to pump messages, and update the UI.
Signature space for rent. Apply by email to....
|
|
|
|
|
my program imports or scans images and preforms icr on the image and archives that image to a drive or cd.
i can also do all this in less that 1 sec.
my program does lots in little time. some scan session will scan over 5000 documents without crashes.
all i need to know if a statusbar can be forced to update.
|
|
|
|
|
In short, no, you can't update the status bar. To update the status bar, at the end of the day, involves sending a message to the status bar itself. There will be no cpu timeslice for that to happen if your one and only thread is blocked.
That is the perfect case for a worker thread. If your user was doing a batch of 5,000 documents each taking 1s, he's going to be waiting a long time. you need to give him a cancel button- and you can't handle the click of the button if your main thread is busy doing scanning.
someone else please back me up on this! or point me out if i'm wrong.
Signature space for rent. Apply by email to....
|
|
|
|
|
actually i have 2 threads. one for scanning or importing and the other for icr and saving.
as thread 1 scans the other processes the prev image (if still in the buffer).
i have a window for the scanner that pops up and there is a cancel button. it all works great the scanner will usally have to process the log that is ready to scan before it stops but i do not have any idle time to have the status bar update when ever.
|
|
|
|
|
Cant u do it from the working thread??
(but be sure to synchronize)
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
if ( MFC )
if ( u have a CStatusBar object )
CStatusBar::SetPaneText
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Hi
Does anyone know how to make an open file dialog with different types of lpstrFilters. I think you have to do something with nFilterIndex...
tx
|
|
|
|
|
MSDN:
Filters
The information in this section applies to both Explorer-style and old style Open and Save As dialog boxes.
You can provide filename filters to assist the user in limiting the filenames that the dialog box displays. A filename filter consists of a pair of null-terminated strings, a description and a pattern, one concatenated to the other. The dialog box displays the description to let the user pick which filter to use; and it uses the pattern to select the files to display.
To specify the filters, set the lpstrFilter member of the OPENFILENAME structure to point to a buffer that contains an array of filter string pairs. The last string in the array must be followed by an extra null character.
A pattern string can be a combination of valid filename characters and the asterisk (*). The asterisk is a wildcard that represents any combination of valid filename characters. The dialog box displays only those files that match the pattern. To specify multiple patterns for the same description, you must use a semicolon (;) to separate the patterns. Note that space characters in the pattern string can produce unexpected results.
The following code fragment specifies two filters. The filter with the "Source" description has two patterns. If the user selects this filter, the dialog box displays only files that have the .C and .CXX extensions.
OPENFILENAME ofn; // common dialog box structure
ofn.lpstrFilter = "Source\0*.C;*.CXX\0All\0*.*\0"
ofn.nFilterIndex = 1;
The nFilterIndex member of the OPENFILENAME structure specifies an index that indicates which filter the dialog box initially uses. The first filter in the buffer has index 1, the second 2, and so on. If the user changes the filter while using the dialog box, the nFilterIndex member is set to the index of the selected filter on return.
You can create a custom filter by setting the lpstrCustomFilter member to the address of a buffer that contains a single filter, and by setting the nMaxCustFilter member to the size of the buffer, in characters or bytes. The dialog box always places the custom filter at the beginning of the list of filters and, on return, always updates the pattern part of the filter with the pattern from the filter selected by the user.
For Explorer-style dialog boxes, the default extension may change if the user selects a different filter. If the user selects a filter whose first pattern is of the form *.xxx (that is, the extension does not include a wildcard character), the dialog box uses xxx as the default extension. This occurs only if you specified a default extension in the lpstrDefExt member of the OPENFILENAME structure. For example, if the user selects the "Source\0*.C;*.CXX\0" filter, the default extension changes to "C". However, if you had defined the filter as "Source\0*.C*\0", the default extension would not change because the extension includes a wildcard.
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
thanks a lot
|
|
|
|
|
Do we have to have a return within a catch block. If yes, and my execution goes into the catch below, will my function return a -1?
catch(CFileException e)
{
CString temp;
temp.Format("Error opening file : %d", e.m_cause);
AfxMessageBox(temp);
return -1;
}
Thanks,
ns
|
|
|
|
|
no, and yes.
-c
All you have to do is tell the people they are being attacked, and denounce the opposition for lack of patriotism and exposing the country to danger.
-- Herman Goering, on how to control the public
|
|
|
|
|
Thank you. SO with no return in the catch, the function just normally exits, if there are no statements after the catch, right?
Appreciate it,
ns
|
|
|
|
|
more specifically, execution will proceed into the catch, executing all statements there, then will proceed onto any statements aftern the catch. it doesn't necessarily exit - it just continues onto whatever comes next.
-c
All you have to do is tell the people they are being attacked, and denounce the opposition for lack of patriotism and exposing the country to danger.
-- Herman Goering, on how to control the public
|
|
|
|
|
Hi,
I have read some of microsoft tutorial about office automation. Now, i would like to fill a set of range with my application, a dialog box application. I have a set of data which are put into a dynamic array, and i would like to read all the value of the array in excel. Could i do it simply without use the expressions Range("A1")... but something like in VBA cells(i,j)?
thanks in advance for your answers
gerald
|
|
|
|
|
Range("xy") *IS* cells(x,y). I don't see your point.
sometimes it helps to look at the IL generated code
a MS guy on develop.com "answering" .NET issues
|
|
|
|
|
if you want to fill cells with a for loop, how we could do that?
for(i=1;i<= Bound;i++)
{
.
.
}
where the term "Bound" could be different for different test( it could be equal to 20 or 10 or another number)
If the size of your set of data is always the same, i know i could do it:
range.GetRange(COleVariant("A1")),COleVariant("B20"))
range.SetValue(COleVariant("2"))
and you will see in each cell of the area A1:B20, the number "2". So, know if the width and/or the height change dynamically, how could i fill the set of cells i need?
|
|
|
|
|
in acrobat reader the mouse turns to a hand in the view and allows the user to grab hold of the view and drag it around.. has anyone seen any articles on implementing this? im sure it couldn't be too hard, but im also wondering if this is somehow copyrighted by adobe.. and what icon to use (or if i would need to create my own).
thanks for any suggestions!
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
I've already posted a couple of messages here about some problems I had with dll's and resources. But nobody seemed to know some sort of solution.
So let's keep it more abstract this time.
What I want to do is create an mfc-dll with one dialog inside, created with the resource editor. The dll's dialog will be called from another app through some sort of ShowDialog()-function.
What dll-wizard do I use for this (mfc-static, mfc-dynamic or mfc-extension)?
Are there any specs to set in the project wizard?
Is there a tutorial about this topic somewhere?
btw. A problem I had was that the lib-files weren't produced anymore after using the classwizard on a dialog created with the resource editor.
using: [VISUAL STUDIO 6.0] [WIN98/2]
|
|
|
|
|
Grote Smurf wrote:
What I want to do is create an mfc-dll with one dialog inside, created with the resource editor. The dll's dialog will be called from another app through some sort of ShowDialog()-function
Your DLL must implement the DllMain entry-point, and attach itself to the chain of app resources, thanks to two calls :
- AfxInitExtensionModule(...)
- instantiation of CDynLinkLibrary(...)
See code below
Grote Smurf wrote:
What dll-wizard do I use for this (mfc-static, mfc-dynamic or mfc-extension)?
Are there any specs to set in the project wizard?
That's up to you.
Now for a sample code :
#include "stdafx.h"
#include <afxdllx.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
static AFX_EXTENSION_MODULE myresourceDLL = { NULL, NULL };
static CDynLinkLibrary *s_Module = NULL;
extern "C" int APIENTRY
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
UNREFERENCED_PARAMETER(lpReserved);
if (dwReason == DLL_PROCESS_ATTACH)
{
if (!AfxInitExtensionModule(myresourceDLL, hInstance))
return 0;
TRACE0("MYRESOURCE.DLL Initializing!\n");
s_Module = new CDynLinkLibrary(myresourceDLL);
ASSERT(s_Module != NULL);
}
else if (dwReason == DLL_PROCESS_DETACH)
{
TRACE0("MYRESOURCE.DLL Terminating!\n");
ASSERT(s_Module != NULL);
if (s_Module)
{
delete s_Module;
s_Module = NULL;
}
AfxTermExtensionModule(myresourceDLL);
}
return 1;
}
__declspec(dllexport) void uselessmethod();
__declspec(dllexport) void uselessmethod()
{
}
sometimes it helps to look at the IL generated code
a MS guy on develop.com "answering" .NET issues
|
|
|
|
|
I believe the example you gave is the result for choosing the mfc-extension dll wizard.
Adding a dialog will work, but using the class wizard to create the dialog class and header file will fail. No lib.-file will be created.
using: [VISUAL STUDIO 6.0] [WIN98/2]
|
|
|
|
|
If you use them ONLY as resource DLLs then it doesnt matter what you choose. Even the Win32 DLL does it.
Only static wont do because its only to be used for lib files linked statically to your app -> thus no DLL is used.
...if you're under 8 or younger. Chris Maunder, the Lounge
|
|
|
|