|
Thank you so much Rajkumar,
First of all, to respond to your comment:
"First of all, obviously, if the margins are overbound it messes up, that is known to the user, do you need to correct it?"
I couldn't agree more. It's another completely ridiculous example user madness. Unfortunately, my inclination to tell the user not to set stupid values has been overruled in this case, so here I am.
My position is that the page setup dialog box is launched from IE. Therefore, I can either subclass IE's window or I can create my own one and replace the existing dialog box.
Is there any way of applying the approach you showed me to an existing Page Setup dialog box owned by IE. I’m working from an ActiveX control running in IE?
Many thanks
Cheers
Tom
Philosophy: The art of never getting beyond the concept of life.
Religion: Morality taking credit for the work of luck.
modified on Friday, January 16, 2009 5:33 AM
|
|
|
|
|
I am having a problem with FindFirstFile, I am writing for WM5 with Visual Studio 2008 90 day trial.
Here is a chunk of code:
int GetTheFile(LPWSTR ddir)
{
LPWIN32_FIND_DATAW ac_file;
HANDLE fileHandle;
int ret=1;
wsprintf(ddir, TEXT("\\*.*"));
fileHandle = FindFirstFile(ddir, ac_file);
if (fileHandle != INVALID_HANDLE_VALUE)
After the FindFirstFile executes, ac_file is unchanged (all 0s),
fileHandle is 0xffffffff (-1 which is invalid handle),
I have tried several different things for ddir ("\\", "\\*.*", "\\Windows",...).
Any ideas?
Thanks
|
|
|
|
|
There are several problems with your code:
This is a pointer to a WIN32_FIND_DATAW struct in which you never initialize and point to a valid location.
LPWIN32_FIND_DATAW ac_file;
It would be better to be more precise about what drive you wish to access such as "C:\\*.*"
wsprintf(ddir, TEXT("\\*.*"));
See if this works for you:
WIN32_FIND_DATAW ac_file = {0};
HANDLE fileHandle =0;
wsprintf(ddir, TEXT("C:\\*.*"));
fileHandle = FindFirstFile(ddir, &ac_file);
if (fileHandle != INVALID_HANDLE_VALUE)
{
}
Best Wishes,
-David Delaune
|
|
|
|
|
I guess I didn't notice that LPWIN32_FIND_DATAW is just a pointer. I was getting a warning that I looked at and just thought "of course its not initialized, it will get a value from FindFirstFile".
So, I'll change that!
This is for a Window Mobile device, so there is no C: drive, it is just \\. Then if you want a memory card, you would enter \\<<i>name of card> like mine is \\SD Card.
I was searching for a file in a particular directory, but the file can have some parts slightly different, here is what I got working to find my file:
int GetTheFile(LPWSTR lpszDir)
{
LPWIN32_FIND_DATAW ac_file;
_WIN32_FIND_DATAW the_dir[MAX_PATH];
HANDLE fileHandle;
int ret=1;
ac_file = the_dir;
wsprintf(lpszDir, TEXT("\\My Documents\\first*.txt"));
fileHandle = FindFirstFileW(lpszDir, ac_file);
if (fileHandle != INVALID_HANDLE_VALUE)
For some reason I could not get the types to work correctly for making ac_file like you suggested, but I got it to work like this, and I can tinker with it now.
This will look for a file in \My Documents named first<something>.txt, like \My Document\first-1209.txt
Thanks for helping me figure this out Dave .
Ken
|
|
|
|
|
Hello everybody,
I have a question once again.
The program I wrote is connected to a Microsoft Access Database, so far this all works fine. My problem is, that I want to write a function that can control whether a specific table is existing in the database and if not the table gets created automatically.
Is there a way to do this with MFC based C++ code?
Greetings
|
|
|
|
|
Member 3554668 wrote: ...the table gets created automatically.
Use CDatabase::ExecuteSQL("CREATE TABLE...") .
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
I want to know how windows loader loads the executables and what are the checks are perfomed by loader,
can anyone tell me where can i find the good article about this.
|
|
|
|
|
|
|
Hi all,
i have SDI type application, i m split it in i row and 2 columns.initially its have size that is i given.
but with help of mouse i m resizing it.
i want to prevent resizing spiltted view.
i want fix the width for both view that is initially i have already mentioned.
please tell me how can i do this.
i waiting for your valuable suggestion and answers.
thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Check this[^]
I hope it helps..
Regards,
Sandip.
|
|
|
|
|
Thanks its done
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Hi, if it wouldn't be a great trouble could anyone direct/suggest me to an article of how to add an navigation pane positioned on the left side like an Outlook 2003. I need to use it as a shortcut bar.
I would switch the views on the right side depending on user selection.
Thanks in advance!
Here at CP I found something similar ("OutlookBar: A Simplified Outlook Style Sidebar Control" ) but for .Net, I need to use it with VC6 MFC.
|
|
|
|
|
Could this[^] be it?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
Thanks for your suggestion. Of course it helped me, interesting stuff.
|
|
|
|
|
Hello.
I build a class, using internaly a component. But I want that the user of the class never knows which type of component it is.
for exemple :
the include file class.h :
#include <windows.h>
#include <classComponent.h>
class MyClass {
private:
classComponent _Component;
public:
MyClass();
Log( string Message);
};
=======================
If a user of my class includes the file class.h, he need to "access" to classComponent.h in it's compiler directive. But He realy only need the library of the component (classComponent.dll) and not the include, because it is MyClass which process access to functions of classComponent..
How can I "mask" the dependendancies on classComponent for the final user ?
Best regards.
|
|
|
|
|
Use a void* to access the hidden classComponent object.
in class.h:
class MyClass {
void* p;
public:
MyClass();
~MyClass();
void DoStuff();
};
in class.cpp
MyClass::MyClass()
{
p = (void*) new classComponent;
}
MyClass::~MyClass()
{
classComponent* p2 = (classComponent*) p;
delete p2;
}
void MyClass::DoStuff()
{
classComponent* p2 = (classComponent*) p;
p2->DoStuff();
}
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
That's really ugly...
|
|
|
|
|
The whole void* and casting stuff isn't needed. Use a forward reference to the classComponent class instead.
In "Class.h":
class classComponent;
class MyClass
{
public:
MyClass();
~MyClass();
void DoStuff();
private:
classComponent *m_pThis;
};
In "Class.cpp":
#include "classComponent.h"
MyClass::MyClass()
{
m_pThis = new classComponent;
}
MyClass::~MyClass()
{
delete m_pThis;
}
void MyClass::DoStuff()
{
m_pThis->DoStuff();
}
This pattern is often called the Pimpl idiom[^].
Steve
|
|
|
|
|
The OP said:
I build a class, using internaly a component. But I want that the user of the class never knows which type of component it is.
Sorry, I was under the impression from his wording that he wanted not just to remove the dependency from his include file but also to hide the fact that he's using a certain component from users of his code (some sort of code obfuscation).
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
I take your point, however, if all the client gets is a forward reference not much is really being given away.
Steve
|
|
|
|
|
What's the exact reason for that ? Will your class be packaged in a dll ? If no, then your user will still need to add the cpp file in his project and he will be able to see your code.
If you're putting your code in a dll and you really really want to hide the members of your class, then extract an interface from your class and makes your class inherit from this interface. Of course, this is a bit more tricky to manipulate because your user will need to 'ask' your dll to create the class, he can't do it himself (he only has the interface).
But once again, I don't really see the point of doing that...
|
|
|
|
|
marcelcerdanjunior wrote: How can I "mask" the dependendancies on classComponent for the final user ?
By *mask* do you mean that you want to make final client application independent of changes made to class classComponent?
Regards,
Sandip.
|
|
|
|
|
I want that the user of MyClass.h doesn't need to have access to all other includes files like classComponent.h
In most libraries, there is not only one, but a lot of include file.
For exemple, I build a simple classLog class using log4cxx from Apache, which used itself a lof of include files.
But the LoggerPtr component will never been used by the final user. My class do the job.
I want that the final user includes only classLog.h and not need a ball of wool of includes he never will use.
best regards.
|
|
|
|
|
marcelcerdanjunior wrote: I want that the user of MyClass.h doesn't need to have access to all other includes files like classComponent.h
That's the only thing you want to do, remove the #include statement at the top of your .h file ? It's completely different than what you said in your first message: you don't need to hide anything at all.
Instead of using an instance of the class, simply use a pointer to the class. This way, you only need to add a forward declaration at the top of your .h file and put the include directive in the .cpp file. A forward declaration is something like this:
class Component;
For more information, google for forward declaration.
EDIT: when thinking a bit about your question, in fact what you want to avoid is that the user of your class do not need to have all those include files on their system when they want to use your class ? Is that your problem ? If yes, then the only way is to provide compiled code (a lib file or a dll) to your user. Because if you move the include into the cpp file, the user will still need to compile the cpp file you provide and this will require the inclusion of the header file.
|
|
|
|