|
Hmm, yeah I was starting to think that building everything from scratch might be the way forward...
If I happen to solve it at some point along the way, i'll post it
Thanks to both of you.
Rich
|
|
|
|
|
Hello
I've found the cause of the problem. To be honest it's a little (well really quite) embarrasing, bit of a schoolboy error. But i think linked to my relevant in experience in windows programming, resource files and dlls!
There appears to have been two problems.
Firstly, these resource files are rather large and while the resource ID in question had the same number across all language variants, several others did not. The resource file also had several duplicated ID numbers.
Since Visual Studio itself was maintaining these and updating them I incorrectly assumed that was OK.
Once I became aware that this was not the case I used a utility to renumber them and ensure no conflicts (free from RiverBlade).
Secondly, even though I was making lots of changes to the resources and the application when debugged appeared to load them correctly I was not seeing any changes.
This was becuase Visual Studio appears to load all dlls from the system directory. I was expecting a debug build to use the debug output folder.
Even though I now know this I still often forget to copy the dlls across after a build. To get round this I have used the Post-Build feature found under Project Settings->Build Events->Post Build Event
In the command line I have placed a MSDOS command to copy all the dlls from the debug directory to the system32 folder.
Rich
|
|
|
|
|
Hello,
i have a problem with creating bitmaps out of a bytearray.
At first, I tell you what i'm actually doing.
I have a Camera class and an Imageprocessing class. The imageprocessingclass
is registered as a observer at the camera class. I connect with the Vfw cap drivers
to my webcam. In my Camera class, there is a static method that contains
the LPVIDEOHDR. In this method i call the Process method from Imageprocessing Class
with LPVIDEOHDR as parameter. That means, i can work with the LPVIDEOHDR structure
in my Imageprocessing class. My Dialog is also an observer registered at
Imageprocessing Class. In Imageprocessing Class i do some filter work and so on.
When the filter work is done i call a Update method from my Dialog with
unsigned char* pData as parameter. At the moment, pData contains greyscaled data.
I've already converted the RGB data to greyscale data in my Imageprocessing Class.
In my Dialog i have live view from my cam.
My Question is how to make a Bitmap out of the unsigned char array and display it
in my dialog on a certain position. I want to display it next to my live view.
I've already created a picture control frame next to the live view. so i can get
the coordinates where i want to display the Bitmap. The Imageprocessing Class permanently
calls the Update method from my dialog and gives the unsigned char array.
So, how to make a Bitmap out of this given bytearray and display it on my dialog next to the live view when my update method has been called ?
the Update method doesnt belongs to MFC or WinApi. My dialog derives from my observer interface and
has to implement the virtual Update method.
I hope havnt confused you too much.
greetings,
cmos
|
|
|
|
|
|
You should be able to use the code Rajkumar linked to.
After CreateDIBSection() succeeds, you can copy your 8bpp data
to the memory at pBitmapBits.
Important note: GDI DIbitmap data is always DWORD aligned for each row -
that means the row size in bytes (commonly called stride - the lBytesPerRow
value in my code) is always rounded to the next multiple of 4 bytes. You'll
need to take that into consideration when doing the copy
Once you've copied the pixel bits, you can use the HBITMAP (hBitmap) in your
picture control.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I've checked out lot s of examplse and code snippets but the problem is still there.
Can somebody help me please ?
My Bytearray contains Gray values.
My OnPaint Methode looks like
OnPaint()
{
if(isIconic)
{
CPaintDC dc(this);
...
...
}
else
{
CPaintDC dc(this);
CDC MemDC;
CBitmap Bitmap;
// what to do here?
CDialog::OnPaint();
}
}
I also had look at this thread here http://www.codeproject.com/script/Forums/View.aspx?fid=1647&msg=2539266
Well, I could compile it without errors. But where can i set my data ?
Just get a black square on my dialog. I am desperated.. Have been looking for hours for a
solution.
cmos
<div class="ForumMod">modified on Saturday, May 24, 2008 10:24 AM</div>
|
|
|
|
|
Are you letting a picture control draw the bitmap or are you rendering
the bitmap yourself?
If a picture control, then you need to set the control's image with the
STM_SETIMAGE message (not in OnPaint()!).
If you're rendering yourself, then in your OnPaint() code, select the created
bitmap into your MemDC then use BitBlt()/StretchBlt() to render the bitmap
from the memory DC to the paint DC.
cmos wrote: Have been looking for hours for a
solution.
Maybe hours that would have been better spent doing a little reading about basic GDI
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
hi,
Can anybody tell me the proper syntax of using regular expressions in vc++ along with a sample code..which is the haeder file to be included to use the regex class? i got a sample code from mdsn..but it is to be compiled in command prompt..is there any other option to use regular expressions not using command prompt?
thanks,
rm
|
|
|
|
|
RegEx is .NET framework library class you need support for /CLR to get compiled as managed C++ code. in VC 6.0 I think it is not possible,
you may search for any C++ implementation available in Web, you can also check [Boost.Regex^] not sure.
|
|
|
|
|
Hello dear friends,
I've browser plugin(toolbar) application & using VC++ 6.0.
I've included a dialogbox resource in the resource file and a class for this dialogbox.
When I use DoModal() to display the dialogbox the GetLastError() returs
"Error BC31019: The specified image file did not contain a resource section"
The problem here is i don't understand.In the text mode the resource
script shows all the things right.Please help me out.
ritz1234
|
|
|
|
|
first test whether ur program initilazing com library. that is coinitialize(NULL).
let me give some piece of code if above method is not solved.
|
|
|
|
|
Are you working with any icons?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi,
I created a MFC Regualr DLL using shared MFC. DLL contains 4 functions which are exported using __declspec(dllexport). Now in the client application i tried to make use of this DLL. two of exported functions are imported using __declspec(dllimport). They are working fine.
Now i tried to make use of third function using LoadLibrary and GetProcAddress. This time i am getting NULL pointer instead of function pointer. Again i placed extern "C" while exporting the function and tried to make use of it.This time i am getting the function pointer and every thing is fine.
Usage of extern "C" makes it work fine. Can any one explain me what actually happening here?
Thanks in advance...
|
|
|
|
|
Because your two first functions probably don't have any arguments. When you are using extern "C", it means that the function should be exported as a C function. In C, there is no function overloading so a function is identified only by its name. In C++, you can overload a function (a function with the same name can have different arguments). Which means that the name is not enough to identify the function. Thus, in C++ is introduced what is called name mangling: the types (and number) of parameters of the function are also used to identify the function. When you use GetProcAddress, you need to use the mangled name of the function (if there's no argument, the mangled name is the same as the function name).
So, by using a C function, you avoid the name mangling.
Hope it makes sense.
|
|
|
|
|
__declspec(dllexport/dllimport) uses C++ naming convention, so that the name exported from the dll is name mangled with C++ language convention, so when you try to get the address of the exported function using GetProcAddress(), the function name string won't match with name of the exported function which is decorted with c++ style, when using extern "C" linkage specifier naming convention used is that of C language which has the same undecorated name as that of the function.
|
|
|
|
|
Hi,
It is very clear now.
Thanks for your reply.
|
|
|
|
|
If you don't use extern "C" the name of the function is mangled the C++ way (you can see this effect viewing your DLL with Dependecy Walker ). That means you need to pass the mangled name to GetProcAddress() .
On the other hand, using extern "C" makes the function have C linkage, hence, roughly speaking, without mangling.
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
|
|
|
|
|
HI,
I got the point.
Thanks for your reply.
|
|
|
|
|
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
|
|
|
|
|
one last solution to avoid using "extern C" is to put a .DEF file in your dll project, which tells to export a symbol as you name it in the file.
|
|
|
|
|
Hi,
Thaks for your solution.
|
|
|
|
|
Hi,
I have ListView with 4 colom, I want to fill color in 3rd coloum. How can I do this?
|
|
|
|
|
|
Replacement message:
ListView is just a CListCtrl wrapped in a View class, so look at CListCtrl articles here on CP. Luckily, it's a later control and more easily part-owner-draw-able, unlike ListBoxes.
Iain.
-------------------------
Original:
I don't know the answer off the top of my head - but I bet you'd have to do some level of ownerdraw. Luckily, the ListView is a later control, and more easily part-owner-drawable. (Unlike ListCtrl).
Have a look on the articles here on CP. You may not find an exact answer, but I bet someone has an article with (eg) different fonts in different rows / columns that could give you a string hint.
Iain.
Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.
modified on Tuesday, May 13, 2008 9:53 AM
|
|
|
|
|
Iain Clarke wrote: Luckily, the ListView is a later control, and more easily part-owner-drawable. (Unlike ListCtrl).
How so?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|