|
Hi all,
I want a good way to encrypting files,
and I want to say that I am a beginner.
Please help me on this,
Cheers,
Thanks.
|
|
|
|
|
|
How about EncryptFile() ?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
filename: cat.h<br />
<br />
#include "dog.h"<br />
<br />
namespace Mammal<br />
{<br />
namespace Dog<br />
{<br />
class Collie<br />
{<br />
void virtual init( Mammal::Cat::Siamese *siamese );<br />
}<br />
}<br />
}<br />
<br />
filename: dog.h<br />
<br />
#include "cat.h"<br />
<br />
namespace Mammal<br />
{<br />
namespace Cat<br />
{<br />
class Siamese<br />
{<br />
Mammal::Dog::Collie *collie;<br />
...<br />
}<br />
}<br />
}
If I try to compile this, I get an error that says "Siamese is not a member of Mammal::Cat
Any ideas why?
|
|
|
|
|
1. You have the two classes (Siamese and Collie) dependant on each other which even if it works is poor practice.
2. Siamese has no functions defined.
Elaine
The tigress is here
|
|
|
|
|
I know it's a circular dependancy, and I promise I'll do penance for that. But that wouldn't account for the compiler not finding Siamese in the Mammal::Cat namespace. And there is more to each class, but these are the lines that I've narrowed down as the most likely candidates for causing the problem. As far as I can tell, the namespaces are set up properly, and Visual Studio has no problem parsing them to generate the class view or to generate the drop-down list for the auto-complete feature, but the compiler won't compile it, claiming that the Siamese class is not a member of that namespace.
|
|
|
|
|
May be you could try forward declaration.
like
namespace Mammal
{
namespace Cat{ Class Siamese;}
}
then, the actual dog namespace
then, the actual cat namespace.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
I am having a difficult time finding my problem in a dll that I am trying to build. This is really my first significant dll. I am trying to export a class from this dll - the dll itself has many classes that support this class, which are not exported, including some that use COM. Some of the supporting classes need to be initialized at the beginning. I am using MFC, but the class being exported is not based on MFC and all the functions in the class use parameters that do not require MFC - so I understand that I do not need to build an MFC extension dll.
I wrote a simple dialog application that included all the classes in the dll, and the dialog with a button that exercises the class that is being exported. Everything works fine. The supporting classes initialize properly, and all the functions in the class to be exported work as expected.
Then I created a project to make the dll with all the same classes. I built the dll and built a new dialog project to test the exported class in dll. The program 'hangs' during initialization that happens in the dll. Here is my problem. When I step through the code, when a function is completed the return statement does not go back to the calling function - it is as though the call stack is somehow corrupted, and there is no next place to step through for the code. How can I find out what is happening? I have never had this particular problem before.
I have another smaller dll that I developed the same way as this which works fine - the basic difference is that this one uses COM to do some ADO, and this dll also has some global variables.
Thanks in advance.
|
|
|
|
|
Does this mean your DLL statically links with MFC ?
Did you use the AFX_MANAGE_STATE macro ?
You might need to call this from each member function of your exported class.
Just because you don't directly export a function calling MFC does not mean that you don't still need to enter the correct state for each other function that is exported.
See "Managing the State Data of MFC Modules" in the MSDN.
|
|
|
|
|
Thanks for the response.
No, I am not statically linking with MFC.
Each of the function that is exported has the AFX_MANAGE_STATE macro in the first line.
I did read the article Managing the State Data of MFC Modules in MSDN, and think that I follow the recommendations.
The problem occurs in a function that is not exported. In fact, it is part of the initialization routine - which iscalled in the InitInstance in of the CWinApp derived class for the dll.
|
|
|
|
|
Does the EXE loading the DLL initialize COM ?
If so, does the COM initialization in the EXE occur prior to the initialization in the DLL ?
You might find that your DLL initialization will need to be deferred to an exported 'initialization' call, rather than in the InitInstance, which is basically the same as DLL_PROCESS_ATTACH. As a result of deferral, some class instances dependent upon COM, if they do 'interesting' operations in their constructors, might not be able to remain global, they might have to be created dynamically. The pointers to instances of the classes could be global, but not the instances of the classes themselves.
Basically, you might need to rework in this order, then:
EXE loads DLL (statically, I am presuming, since DLL is linked to EXE)
EXE initializes COM
EXE calls 'init' function exported from DLL
DLL 'init' function 'creates' global objects
...EXE does other work...
EXE calls shutdown function in DLL
DLL frees global objects
EXE uninitializes COM
Windows unloads DLL from EXE address space
EXE exits
You can also get into trouble with COM when creating instances and references to objects that MIGHT not be activated or deleted by the same thread in the EXE as those objects were created.
|
|
|
|
|
Thanks - I will try this - makes eminent sense. It is fairly straightforward to export an Init function that the .EXE's startup can call.
I had narrowed it to being a COM related issue as the inintialization works if I comment out the COM related code.
|
|
|
|
|
Thnaks,
Once I made sure that all initialization and COM calls came after the dll has been loaded - things worked out. I had to instantiate the global objects in an exported Init function subsequent to loading as you had suggested, and have a corresponding ShutDown function that cleaned up the gloabal objects before dll was unloaded. Having the cleanup code as part of unloading the dll frequently led to access violations.
|
|
|
|
|
In my application I've set the REALTIME_PRIORITY_CLASS.
It manages a worker thread that works at REAL_TIME_PRIORITY_LEVEL
(while the main thread has been set at IDLE_PRIORITY_LEVEL).
The goal'd be to let the worked thread to loop periodically
with its own multimedia timer without being stopped by the
user interface (in example when the user clicks the mouse).
My problem is that when the user stimulates the user interface
(mouse and windows) the worker thread stops for a while.
How can I let my theard loop without being affected by the
user actions ?
Is there a way to let the user interface to have really a very low
priority ?
Thanks a lot !
|
|
|
|
|
Hello,
You can try to set the prioity of your process to a higher level. Windows will give your process a bigger timeslice. Your process will give most of the time to your worker thread.
But be carefull with setting your process priority to realtime. If you do this, Windows will give almost all the time to your process and other applications could 'freeze' because there is no time left..
Hope this helps.
I also got the blogging virus..[^]
|
|
|
|
|
Thanks for your help but, as I've written in my first post,
I think to have already done what you say. I've used the following instructions in the InitInstance function of the App class:
SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS);
SetThreadPriority(THREAD_PRIORITY_IDLE);
Then I've used the next call in my worker thread:
SetThreadPriority(THREAD_PRIORITY_TIME_CRITICAL);
Is there something more to do ?
|
|
|
|
|
Hello,
There could be many reasons for your worker thread to stop for a while. A few of these reasons could be:
<list> Your processor is slow
Your GUI thread synchronizes access to some object with your worker thread using synchronization objects, that block your worker thread
The library that you are using is not very optimized
...
It should not be neccesary to set your process priority to realtime. If you don't let your worker thread run in it's own seperate process, windows ensures that it will always be interupted when the user stimulates the GUI...
I also got the blogging virus..[^]
|
|
|
|
|
Ok, so... as I was thinking the only way to really separate a thread by the user interface is to create it in a separate process created by the main application.
Thanks a lot for your advice !!
|
|
|
|
|
|
I'm stuck and would be really grateful if someone could help. I have written an application that builds an application to run on a Linux system!
The windows application that builds the Linux app has to create .cram files. the only way i know of doing this is using mkcramsf.exe but, with the size of the .cram file i am making, this takes ages (over 5 hours on a low spec PC!)
If i could find some source code on making a cram file i could embed that code into a function in one of my application classes and therefore speed the process up by a considerable ammount. It would appear (looking at examples available on the web) that this is not a common thing to attempt to acheive so i would be very grateful if anyone could help!
Thanks in advance to anyone who can.
steve333
|
|
|
|
|
I've tried to load the bitmap, which is already located in Access, to a picture loadbox on a FormView.
The process is that when I click a next button from a tool bar, the person's info. is changed.
When the program is run, the picture of the first person's image is loaded but not all people.
I wanna know DIB Funtion but all sources are based on API(Actually I am a real beginner.)
I've searched some books but the book explains just basic DIB process and just basic DB access.
Appreciate your advice that which Funtion prefer to.
Especially, what kind of process will be the best to get the bitmap image from the Access to the FormView.
Simple source will be more helpful.
Thanks and regards,
|
|
|
|
|
I'm trying to get the command line parameters of a running process. Does anyone know how to do this? I know I can set a windows hook with WH_SHELL, but I would like to be able to do it on the fly instead of having my application started before the processes I'm trying to view.
-- Rocky Dean Pulley
|
|
|
|
|
You could use the GetCommandLine API.
Put this API in a function and run the function remotely using CreateRemoteThread.
« Superman »
|
|
|
|
|
Thanks, that's what I'm about to try. I was hoping there was a way to do it without injecting anything but this will do I think.
Thanks,
-- Rocky
-- Rocky Dean Pulley
|
|
|
|
|
The fourth parameter to CreateRemoteThread() is the starting point of the new thread. How do you go about getting that starting point (i.e., function) into the other process?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|