|
Aaargh! you got me ...
|
|
|
|
|
I know this may look a little more than a little strange! But for a reason I want to write a whole function in a file at run-time. OK, let's do some clarification:
see you have a function like:
void foo ()
{
your code ...
}
after compilation we have some thing like:
push 210
mov eax, ebx
...
and in binary level:
E8 00 DA 65 00 00 DF
What I need is to write these binary codes in a file.
Note
1- There's no such an instruction like mov eax, eip or pop eip in Intel instruction set. Actually there's no instruction to get or set eip directlt.
Thank you masters!
|
|
|
|
|
Why don't you get the compiler output?
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 I need to write it anywhere I want. I don't want to use the simple copy-paste method.
|
|
|
|
|
The you have to write a compiler...
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]
|
|
|
|
|
As I understand it, you want to include in your executable, a number of Datablocks which you want to use as prototype executable files, to be called by your process. This can be done, and I've done it. If that's what you want, it also requires No ASM Code to implement!
Bram van Kampen
|
|
|
|
|
Hi,
I have a binary image with black background and a white object. I want to implement c++ codes that will detect when there is a hole in the object (black cell in the white object). I want to be able to know precisely the size of the hole and where it is located on the object.
Can someone give me any advice.
Thanks in advance,
Franck
|
|
|
|
|
One possibility could be using GetPixel () .
If you know the coordenates of that white shape, then you can just check in the shape if the pixels contained are white or black and increment a counter to know the area of the target object.
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Thanks for the answer,
Unfortunately, I do not know the coordinates of the white shape.
Franck
|
|
|
|
|
Then you are going to use the same to locate it first.
If the white object is with a random shape, and random coordinates I think you are going to check the whole image, and then process it.
You can get an approach of using a 2d array full with 0 (black) and 1 (white) to simbolize the image.
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
the main term you'll need to research is "blob detection and analysis".
it's a big and complicated subject, however.
|
|
|
|
|
maybe i can help you.
You will have to scan your image pixel by pixel. Getpixel() is one approach but is not very quick. The second approach is to get a pointer to the pixeldata. I'm not sure what you want to do with the results but one of the things you could do is to create a region (a clipping area) of those holes. Weaponed with that you could fill it or do everything you like. A region will not give you a direct insight of the size (because it may be a complex (non-rectangular) object) but -although unknown- holds a representation of the hole.
If you feel this approach will help you feel free to send me an email - I can give you an algorithm to create a region from a complex figure.
Rozis
|
|
|
|
|
franckesh wrote: I have a binary image with black background and a white object. I want to implement c++ codes that will detect when there is a hole in the object (black cell in the white object). I want to be able to know precisely the size of the hole and where it is located on the object.
What is the nature of the binary image. It appears to describe a Picture. Now,Is it a Bmp (Bitmap), Is it a GIF File, what is it, or, is it just that, an image prior to capture(e.g. in your mind only).
What can open and display it as a File? Is it per chance encrypted?
None( Or maybe very few) of the contributers are clarevoyants. You want to be more specific before you can expect a reasonable answer. I suggest that a bout of reading may solve a lot.
Bram van Kampen
|
|
|
|
|
Thanks for the reply,
the binary image is a picture of a boat. The boat has an arbitrary shape. And the file is a bmp file.
Franck
|
|
|
|
|
Hi,
I guess this problem can be solved by 4/8 connected components alogorithm. do a runlength encoding of image
and perform a depth first search to find connected components , from that you can identify holes.
Regards,
Shiju
|
|
|
|
|
First find the hole, then search in an expanding spiral to find the hole's bounds.
Searching every pixel in the image is slow. If you have any advance knowledge about the image and hole, you can use this to speed up the search.
For example, if you know the hole will be over 10 pixels wide, you can search every 10th pixel, looking for the hole. This will speed up your search by a factor of 10.
|
|
|
|
|
Hi,
I have created a little custom CListCtrl that uses CComboBox and CEdit.
I need to use my edit control for displaying a path.
Is it possible to add the browse option, i.e. when the edit control is selected a browse button appears at the end of the Edit Control?
TIA
Tony
|
|
|
|
|
You should be able to create an owner drawn edit control in which you can handle its WM_PAINT message and show the button.
|
|
|
|
|
I am trying to play (synthesize) some notes when user presses keyboard keys.
I use midiOutShortMsg from mmsystem.h to play notes, but there is an audible delay (about 0.1 sec) before sound starts playing.
I've heard of DirectMusic, but it is deprecated and I can't find any download link for DirectX 8 (which was the last release containing it).
Is there any workaround?
|
|
|
|
|
In case anyone is interested, I solved this problem using ASIO. There is a free driver, ASIO4ALL, that suits almost any audio card (in case your native driver does not support ASIO). The delay is unaudible now.
|
|
|
|
|
This question sounds silly.. but i am confused. i wanted to know what is the order in which the classes are called in an SDI Application.
|
|
|
|
|
Broadly speaking I think it goes like this: the CApp() derived class is created first and that then creates the CMainFrame which creates the CView . The CDocument() is then created by the framework and connected to the view. You can use the debugger to step through your application to see exactly what is the sequence of events. Don't forget to put breakpoints in the proper places so you can quickly skip over all the framework code.
[edit]spelling[/edit]
|
|
|
|
|
you can set MessageBox in your code and you will get the order,for example:
you set a messagebox in your VIEW CLASS of LBUTTONDOWN function,set messagebox in your DOC CLASS of LBUTTONDOWN function,and set a messagebox in your APP CLASS of LBUTTONDOWN function,you click the program's client,the
view box will display,then you remove the VIEW MESSAGEBOX ,then click the program's client,DOC MESSAGEBOX display........
|
|
|
|
|
creating simple dilog box without using resource script...please help urgent requitement
kir_MFC
|
|
|
|
|
This is the third time you have asked this question (or a variation of it). Try reading the documentation on MSDN[^], and using one of the examples.
|
|
|
|