|
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
|
|
|
|
|
But, how can I actualy add a dialog? If I use the class wizard, the .lib-file is not created anymore.
using: [VISUAL STUDIO 6.0] [WIN98/2]
|
|
|
|
|
Hi!
I'm really confused of what my program is doing.
I have typical MFC application, serving as FTP Server. For easier controlling, I put the most used commands into tray icon menu. These commands' identificators are equal to the appropriate commands in main menu of the application. (eg. ID_SHOW_STATISTICS etc...).
And now, the strange behavoiur - when some user is uploading data on the server (upload is performed in separate thread), and I choose on of the commands in tray menu, the server freezes up. In other words, uploading progress is frozen. I even exactly can see what routine my program stopped in - it is CAsyncSocket(or CSocket)::ConnectHelper(), function called from CSocket::Connect() routine. This routine never returns (I think that there is some calling of PumpMessage but I'm not sure...)
BUT, when I choose the SAME command from main menu (not from tray), this problem doesn't appear. Can anybody explain this behaviour to me please ? I really don't know what to do now.......
Any suggestion will be appreciated!
Thanks in advance.
Standa.
Celebrate Mr. Cesilko!
|
|
|
|
|
Hello
I have been working on an MDI program, in which two child windows are being used. I have been attempting to switch between these windows since I need user input in one, and to draw in the other. I have attempted to pass the window device context between modules, but I get a first chance exception error at run-time.
I also have been experimenting with getnextwindow(), setfocus() routines, but noothing happends when I use them.
Help
|
|
|
|
|
The "new folder' button seems wrong when you are opening a file in the OPen dialog, unless I'm missing something. How does one prevent it from showing? I didnt see an OFN_ flag to do that...
Thanks,
ns
|
|
|
|
|
For my browse folder I have the following flags set:
BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS|BIF_NONEWFOLDERBUTTON
The compiler chokes on the last and says it doesnt know BIF_NONEWFOLDERBUTTON
Any ideas why?
Thanks,
ns
|
|
|
|
|
Never heard of this one,
ulFlags
Flags specifying the options for the dialog box. This member can include zero or a combination of the following values: BIF_BROWSEFORCOMPUTER Only return computers. If the user selects anything other than a computer, the OK button is grayed.
BIF_BROWSEFORPRINTER Only return printers. If the user selects anything other than a printer, the OK button is grayed.
BIF_BROWSEINCLUDEFILES The browse dialog will display files as well as folders.
BIF_DONTGOBELOWDOMAIN Do not include network folders below the domain level in the tree view control.
BIF_EDITBOX Version 4.71. The browse dialog includes an edit control in which the user can type the name of an item.
BIF_RETURNFSANCESTORS Only return file system ancestors. If the user selects anything other than a file system ancestor, the OK button is grayed.
BIF_RETURNONLYFSDIRS Only return file system directories. If the user selects folders that are not part of the file system, the OK button is grayed.
BIF_STATUSTEXT Include a status area in the dialog box. The callback function can set the status text by sending messages to the dialog box.
BIF_VALIDATE Version 4.71. If the user types an invalid name into the edit box, the browse dialog will call the application's BrowseCallbackProc with the BFFM_VALIDATEFAILED message. This flag is ignored if BIF_EDITBOX is not specified.
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
ulFlags
Flags specifying the options for the dialog box. This member can include zero or a combination of the following values: BIF_BROWSEFORCOMPUTER Only return computers. If the user selects anything other than a computer, the OK button is grayed.
BIF_BROWSEFORPRINTER Only return printers. If the user selects anything other than a printer, the OK button is grayed.
BIF_BROWSEINCLUDEFILES Version 4.71. The browse dialog box will display files as well as folders.
BIF_BROWSEINCLUDEURLS Version 5.0. The browse dialog box can display URLs. The BIF_USENEWUI and BIF_BROWSEINCLUDEFILES flags must also be set. If these three flags are not set, the browser dialog box will reject URLs. Even when these flags are set, the browse dialog box will only display URLs if the folder that contains the selected item supports them. When the folder's IShellFolder::GetAttributesOf method is called to request the selected item's attributes, the folder must set the SFGAO_FOLDER attribute flag. Otherwise, the browse dialog box will not display the URL.
BIF_DONTGOBELOWDOMAIN Do not include network folders below the domain level in the dialog box's tree view control.
BIF_EDITBOX Version 4.71. Include an edit control in the browse dialog box that allows the user to type the name of an item.
BIF_NEWDIALOGSTYLE Version 5.0. Use the new user interface. Setting this flag provides the user with a larger dialog box that can be resized. The dialog box has several new capabilities including: drag and drop capability within the dialog box, reordering, shortcut menus, new folders, delete, and other shortcut menu commands. To use this flag, you must call OleInitialize or CoInitialize before calling SHBrowseForFolder.
BIF_NONEWFOLDERBUTTON Do not include the "New Folder" button in the browse dialog box.
BIF_RETURNFSANCESTORS Only return file system ancestors. An ancestor is a subfolder that is beneath the root folder in the namespace hierarchy. If the user selects an ancestor of the root folder that is not part of the file system, the OK button is grayed.
BIF_RETURNONLYFSDIRS Only return file system directories. If the user selects folders that are not part of the file system, the OK button is grayed.
BIF_SHAREABLE Version 5.0. The browse dialog box can display shareable resources on remote systems. It is intended for applications that want to expose remote shares on a local system. The BIF_USENEWUI flag must also be set.
BIF_STATUSTEXT Include a status area in the dialog box. The callback function can set the status text by sending messages to the dialog box.
BIF_UAHINT When combined with BIF_NEWDIALOGSTYLE, adds a usage hint to the dialog box in place of the edit box. BIF_EDITBOX overrides this flag.
BIF_USENEWUI Version 5.0. Use the new user interface, including an edit box. This flag is equivalent to BIF_EDITBOX | BIF_NEWDIALOGSTYLE. To use BIF_USENEWUI, you must call OleInitialize or CoInitialize before calling SHBrowseForFolder.
BIF_VALIDATE
Thats from my MSDN (Oct 01 I think)
Thanks,
ns
|
|
|
|
|
OK. If it doesnt exist how to prevent the new folder button from showing up?
Thanks,
ns
|
|
|
|
|
I did a search of my Platform SDK header files and found,
#define BIF_NONEWFOLDERBUTTON 0x0200 // Do not add the "New Folder" button to the dialog. Only applicable with BIF_NEWDIALOGSTYLE.
Michael
"Time and tide melts the snowman."
-- The Doctor (Doctor Who: Time and the Rani
|
|
|
|
|
Thats great! I have to make sure the NEWDIALOGSTYLE doesnt cause problems on win 98 etc...but the info is terrific!
Thanks,
ns
|
|
|
|
|
I want to make a simple COM component in MFC (without using ATL). I know how to make it. But i want to fire events from this component, and i don't know how to do this. Is there any sample application you know that can do this ?? I searched here at CP but i only find applications that are made with support of ATL.
|
|
|
|
|
I have answered this question already, a day or two ago.
sometimes it helps to look at the IL generated code
a MS guy on develop.com "answering" .NET issues
|
|
|
|
|
in vc6, this short program run well
#include "stdafx.h"
#include "windows.h"
int main(int argc, char* argv[])
{
WORD w = 192;
BYTE l;
l = w;
return 0;
}
get l =192;
but the almost same piece of code in VC7, get l=0;
#include "stdafx.h"
#include "windows.h"
int _tmain(int argc, _TCHAR* argv[])
{
WORD w = 192;
BYTE l;
l = w;
return 0;
}
What's wrong? Is only my compiler go mad or all vc7 compiler get the same result?
|
|
|
|
|
Same result for me between VC6 and VC7. BYTE and WORD typedefs haven't changed so there is no good reason for a problem.
sometimes it helps to look at the IL generated code
a MS guy on develop.com "answering" .NET issues
|
|
|
|
|
Could it be the optimiser saying you don't use 'i' therefore I'm not gonna bother calculating it?
Blade[DMS]
|
|
|
|
|
That's interesting, I get 192 in VC7 and a debug build...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
The MSDN says:
CListCtrl::SetItemCountEx
This method sets the virtual number of items in a virtual list view control.
What's a virtual list view control?
And, when does I use SetItemCountEx and when SetItemCount?
--
Nice greets, Daniel.
|
|
|
|