|
The & symbol was lost during the copy/paste operation. Something (VS, the clipboard, the web page edit control) replaced all occurences of that symbol with "amp &" so I was forced to edit the copied code. I deleted the symbol by accident, sorry. It's missing only from the message, not from the code.
CMyObArray it's a class derived from CObArray MFC class. I use it for it's ease to add/remove array elements. In the end it will be more than an array of objects, it will also hold all relevant info about the map (like the position of starting and ending cell, a pointer to an array describing the map, a function to retrieve minimal the object with the minimal distance and so on.) At this time it's only a minimal scratch.
The header file is:
#pragma once
#include "atltypes.h"
// CMyObArray command target
class CMyObArray : public CObArray
{
public:
CMyObArray();
virtual ~CMyObArray();
CPoint cellBegin;
CPoint cellEnd;
};
The cpp file is:
// MyObArray.cpp : implementation file
//
#include "stdafx.h"
#include "Test551.h"
#include "MyObArray.h"
// CMyObArray
CMyObArray::CMyObArray()
: cellBegin(0)
, cellEnd(0)
{
}
CMyObArray::~CMyObArray()
{
}
// CMyObArray member functions
For he first parent I can pass any CObject casted to CMyOb. It doesn't matter if some class members will be incorrect as long as I only use it as a marker for the end of the path in searching.
Now you know all about that problem to test it on your own computer. I used the VS 2008 full version in a dialog based project. Apart form the ccode I posted, there's nothing else in the project except what VS automatically generated.
|
|
|
|
|
I found a solution by declaring the necessary objects for initialization at global scope. Here it how the MyOb.cpp file looks:
// MyOb.cpp : implementation file
//
#include "stdafx.h"
#include "Test551.h"
#include "MyOb.h"
// CMyOb
CMyObArray a;
CMyOb* pB = NULL;
CMyOb::CMyOb()
: myArray(a)
, parent(*pB)
{
}
CMyOb::CMyOb(CMyObArray& arr, CMyOb& par, CPoint pos)
: myArray(arr)
, parent(par)
, position(pos)
, distDone(0)
, distToGo(0)
{
}
CMyOb::~CMyOb()
{
}
// CMyOb member functions
Obviously, the pB pointer id invalid, it's only purpose is to trick the compiler. It's not supposed to be used in any way.
Frankly, it's a sh**, i'll use a structure instead of the class CMyOb.
|
|
|
|
|
I think I got the madness of creating my first MFC Dll figured out.
Now for the proverbial $64 question.
The DLL is being developed concurently with the main program as dependant of the main program. The OS looks for it in many places execept in the current DLL Debug directory!
I was thinking I could use Post / Pre link in Project Setting to copy the DLL to some OS accessible place - OS/System32 for example.
I do not know how to do this.
Any other idea, preferably simpler, how to do this would be nice.
Any constructive help as allways is appreciated.
Vaclav
-- Modified Monday, March 8, 2010 1:48 PM
|
|
|
|
|
10 develop
20 update the DLL
30 GOTO 10
|
|
|
|
|
Sir, we need a break (or a ) somewhere... 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]
|
|
|
|
|
I thought that using GOTO is immoral.
I think you answered before I typed my message.
It got posted empty first!
|
|
|
|
|
Vaclav_Sal wrote: I thought that using GOTO is immoral.
AFAIK best things in life are immoral. 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: AFAIK best things in life are immoral
|
|
|
|
|
CPallini wrote: AFAIK best things in life are immoral.
They're only said to be immoral by people who don't want you to have a good time. You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
Well, if you don't care about definitions, then you may enjoy immorality... 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]
|
|
|
|
|
I make up my definitions as I go along, I find keeping them confused is advantageous. And if someone didn't think it was immoral, it wouldn't be nearly as much fun. You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
My old boss used to say:
If you can't impress with brilliance, dazzle with BS!
|
|
|
|
|
Vaclav_Sal wrote: I do not know how to do this.
if you're using VS03 or higher, you can do something like this:
go to the Build Events / Post Build Event screen. for the Command, enter copy $(TargetPath) outDir - where "outDir" is the target directory.
|
|
|
|
|
Thanks Chris.
Works as advertized in VC 6.0.
Added it to Post-link step and got this:
Generating Code...
Linking...
Creating browse info file...
Copy DLL post build step
1 file(s) copied.
OpenHR.exe - 0 error(s), 0 warning(s)
Thanks again, Chris you are "the man".
Vaclav
|
|
|
|
|
What about changing the directory where the linker outputs the DLL in the DLL's project settings? Or do you need to keep the original copy there for some reason? You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
Tim,
I like your approach better. Change the source, rather then the result.
KISS attitude.
No , there is no reason to keep the original and make a copy.
Thanks
Vaclav
|
|
|
|
|
Just for completeness, you can add a folder where the system searches for DLLs using SetDllDirectory .
|
|
|
|
|
Good one.
I may have to write a short paper on this to repay for all your inputs.
You guys are soooo smart and helpful.
Thanks again.
Vaclav
|
|
|
|
|
I am a beginner in using c++ and I am assigned the following task:
Currently I am using a 3D positioning Device with its provided SDK. In order
for me to recieve the 3D coordinates I must provide a proper window handle.
I understand how to create a window handle but now my question is this, how
can I read data from within a handle such that I can translate this into data
that I can send to MATLAB?
|
|
|
|
|
You should read carefully the SDK documentation. If a window handle is requested then probably the window will receive notifications (in the form of Windows messages) from the library.
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]
|
|
|
|
|
ok my situation is:
i have a panel with 3 picture_box, but in general with 3 control
--------------------------------------|
| panel 1 |
| -------------------------- |
| | | | | |
| | img 1 | img 2 | img 3 | |
| | | | | |
| -------------------------- |
| |
|-------------------------------------|
over this panel i design a new semi-transparent form...what i want is that clicking on form1 in correspondance with the "img1" i can raise img1 click event....
i'm actually able to get the right control where i'm on, but i would like to be able to raise events.
I know it's possible by extending the "picture box" class or by using a "button" with performClick method but i'd like to know if there is something for the general control class?
thank in advance
|
|
|
|
|
If your control is derived from CWnd , You should be able to define handlers for OnLButtonDown , OnLButtonUp , ..Watched code never compiles.
|
|
|
|
|
Hello.
I have a component in VB (Yeah i know here is C/C++ forum) and this component uses JPEG files as input.
For example;
MyComponent.File="C:\myimage.jpg"
My problem is i want to protect this image from othere people.
The question is ? How ?
Can i write a DLL or any other file which responds as JPEG file to my software with an encryption mechanism.
For example;
OPENFILE
My.Component.File="mydll.dll"
This dll will send an encryption key to my software and if everything is ok it will reply as jpeg file.
Its not problem to protect print screen key or cameras. I just want to protect jpeg image.
|
|
|
|
|
Why don't you just encrypt the file content and then decrypt it inside your VB application?
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]
|
|
|
|
|
Because components wants from me a jpeg file path.
|
|
|
|