|
VC doesn't have any built in support for image processing. You're going to either have to find a 3rd party library to use (http://www.smalleranimals.com/isource.htm) or learn to read/write BMP files.
Good luck.
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
I use LeadTools (www.leadtools.com) which is a very thorough imaging library as well as being fast. The one drawback is that it is not the easiest library around.
|
|
|
|
|
Firstly, thank you for your answers.
Secondly I want to ask a thing more. Do you know where I can get the code o the algorithms (for vc++) of operations like binarize, equalization, segmentation, ... because I'm a little (well, a lot) lost.
Thank you again.
Jose Luis
|
|
|
|
|
errrr ... that was the point of the answers i think ... i dont know where anyone is giving away such source code for free
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
Hi, firstly sorry for my English but it isn`t my own language.
I have to insert a bmp image in a database field, but I can´t. I have done the database with DAO and dynamic style (using the Get/SetFieldValue functions), and with VARIANT data type. I want to insert the bmp through a field (of CLongBinary or CByteArray style) of a dialog box but I don`t know why I can`t do it.
Thanks, José
Jose
|
|
|
|
|
Hello, the codegurus around the world.;)
I remebered to read some article for this in MSDN help,
so I try to find this.
Unfortunately, I didn't find the same one, but found some tips.
I don't know how to convert bitmap file to BYTE format,
but I expect that this will help you?
HOWTO: Accessing Binary Data Using dbDao
--------------------------------------------------------------------------------
The information in this article applies to:
Microsoft Visual C++, 32-bit Editions, versions 4.0, 4.1, 4.2, 4.2b, 5.0, 6.0
--------------------------------------------------------------------------------
SUMMARY
When using the DAO SDK C++ classes to access binary data (such as a bitmap) you will find
that the data is returned in a COleVariant. COleVariant is an MFC class that wraps the
OLE VARIANT data type. Within the VARIANT, the data is stored as an OLE SAFEARRAY.
Extracting the binary data from the COleVariant requires some knowledge of VARIANTs and
SAFEARRAYs. The sample code below illustrates how to work with these data types by providing
a function for extracting binary data from a COleVariant and a function for storing binary data in a COleVariant.
MORE INFORMATION
Sample Code
BOOL GetBinaryFromVariant(COleVariant & ovData, BYTE ** ppBuf,
unsigned long * pcBufLen)
{
BOOL fRetVal = FALSE;
if(ovData.vt == (VT_ARRAY|VT_UI1))
{
*pcBufLen = ovData.parray->rgsabound[0].cElements;
*ppBuf = new BYTE[*pcBufLen];
if(*ppBuf != NULL)
{
void * pArrayData;
SafeArrayAccessData(ovData.parray,&pArrayData);
memcpy(*ppBuf, pArrayData, *pcBufLen);
SafeArrayUnaccessData(ovData.parray);
fRetVal = TRUE;
}
}
return fRetVal;
}
BOOL PutBinaryIntoVariant(COleVariant * ovData, BYTE * pBuf,
unsigned long cBufLen)
{
BOOL fRetVal = FALSE;
VARIANT var;
VariantInit(&var);
var.vt = VT_ARRAY | VT_UI1;
SAFEARRAYBOUND rgsabound[1];
rgsabound[0].cElements = cBufLen;
rgsabound[0].lLbound = 0;
var.parray = SafeArrayCreate(VT_UI1,1,rgsabound);
if(var.parray != NULL)
{
void * pArrayData = NULL;
SafeArrayAccessData(var.parray,&pArrayData);
memcpy(pArrayData, pBuf, cBufLen);
SafeArrayUnaccessData(var.parray);
*ovData = var;
VariantClear(&var);
fRetVal = TRUE;
}
return fRetVal;
}
CdbRecordset rs;
COleVariant ovData = rs.GetField(_T("MyBinaryField"));
BYTE * pBuf = NULL;
unsigned long cBufLen;
if(GetBinaryFromVariant(ovData,&pBuf,&cBufLen))
{
COleVariant ovData2;
if(PutBinaryIntoVariant(&ovData2,pBuf,cBufLen))
{
rs.AddNew();
rs.SetField(_T("MyBinaryField"), ovData2);
to the table
rs.Update();
}
if(pBuf)
delete pBuf;
}
Additional query words: kbgrpMFCOLE
Keywords : kbcode kbole kbprg kbDAO kbMFC kbVC400 kbVC500 kbVC600
Version : winnt:4.0,4.1,4.2,4.2b,5.0,6.0
Platform : winnt
Issue type : kbhowto
Technology : kbvc
Last Reviewed: March 13, 2000
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.
--------------------------------------------------------------------------------
Send feedback to MSDN.Look here for MSDN Online resources.
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
<<< In the name of GOD >>>
Hi all.
My program is in SDI mode.
I created dialog in my program, CDi (dialog class).
I want to add member variable to CDi:
First i add #include "MyProgramView.h" to Di.h
Then i write CMyProgramView *pView; in Di.h
But compiler indicate to me 3 errors:
error C2143: syntax error : missing ';' before '*'
error C2501: 'CMyProgramDoc' : missing storage-class or type specifiers
error C2501: 'GetDocument' : missing storage-class or type specifiers
Please help me !!!
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
The view class is attached to the document class it uses - include MyProgramDoc.h as well and all will be fine.
I'd suggest using AfxGetMainWnd/GetActiveView instead of carrying a pointer though.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Ok,
Thank you for reply and for your notice about get pointer from view.
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Hi,
I'm fairly new to windows programming, but know a few things. I'm writing a tweaker and want to integrate it into the display properties tab. I checked out MSDN and found the explination rather cryptic. Can anybody point me towards a tutorial for this?
Thanks alot
|
|
|
|
|
|
Doh! Thanks alot, I just found out about this site, and I should have checked out the articles first.
Thanks again.
|
|
|
|
|
Hi all.
I need a function to check whether internet connection exists on a local machine. There is a Wininet api for it but apparently, it is not full proof. There are cases it does not give correct answer.
If I use a function to connect to certain url to check whether internet exists, it is also very slow and often freeze the hosting apps.
Anyone know how to detect internet connection with a good response (QUICK)? or anyone has implemented a code for it already and willing to share?
|
|
|
|
|
Hello, the codegurus around the world.;)
First of all, I can't share this code since this code is my company property.
One way is to use NON-BLOCKING socket.
1) Get the source code the raw socket of ping code from MSDN sample.
2) Use the NON-BLOCKING socket (this prevents the program from hanging.)
3) Find DNS of LAN and ping to the couple of URL.
Acutually, WinInet class isn't as powerful tool as we think.
I guess that this uses BLOCKING socket, so we have to write our own class...
We may also use thread with BLOKCING socket (WinInet).
So,this may prevent the application hanging.
Also, the response speed is an issue.
As long as we use LAN, DNS detection is enough, and fast.
But, without LAN, and ISP connection, we only use something like URL.
Anyway, good luck.
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
Hi. Thanks for the answer. However, using ping is not very good idea because a site might block the request. Hence, there is always a request time out.
Any other method that I could use?
Thanks
Hendrik
|
|
|
|
|
Hello, the codegurus around the world.
So, I told that the application pings to a couple of URL.
In fact, www.cnn.com didn't work for the ping.
CNN web site adds some functionality to take off ping command from the router?
If at least of one URL among 100 URLs works, this measn the local computer connects Internet.
We don't need all 100 URL information, so if 5th URL works,just skip 95 URLs.
Good Luck
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
why not ping codeproject.com
|
|
|
|
|
Hello, the codegurus around the world.;)
Basically, I don't want to make Codeproject website slow....
We should avoid DOS (Denial Of Service) ? to Codeproject web site.
Even though Codeguru web site responses fast, Codeproject responses too slow.
I hope that Codeproject web site uses mutli-cast host for this web site.
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
I have a regular DLL (that uses MFC). It has an app class (as expected). There is an "interface" .cpp/.h file that allows executable programs to use the dll. Many/all of these interface functions use "((CMEDS32App*)AfxGetApp())" to get a pointer to the DLL's app class and calls functions in that app class. The interface functions all use "__stdcall" in the protoctypes, so it looks like they were conetmplating allowing the DLL to be used from other languages (VB, etc). This all looks pretty normal to me.
Can someone comment on how difficult it would be to compile the code contained in this DLL to a static .lib file?
|
|
|
|
|
sounds to me like it would depend on how much the code relied on the CWinApp stuff. if it's just calling out to a bunch of classes that really don't care about the current CWinApp, then it might be easy - just clip off all the CWinApp stuff and add some AFX_EXT_CLASS macros to the classes you need to export.
but, without seeing the code, it's tough to say.
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
Hi all,
I am trying to post a structure to a Created Worker Thread !All the members of the structure are BSTRs.I am defining all the members of the structure & posting the structure as the WPARAM of PostThreadMessage.(I am typecasting the pointer to structure as WPARAM).
The problem is I am able to post the structure with all the member values correctly !But while getting that Thread Message & retrieving the values of the members some of the Member values r received wrongly !I have used SysAllocString while getting back the values of members !
How can I rectify the problem !
Thanx!
Y.Yamini Devi
|
|
|
|
|
Yamini,
It sounds like you are passing in a pointer to the structure properly, and some of the data is correct. But since the interface thread is still running, perhaps the values that were originally stored in the structure have been changed before you got a chance to read them? (Just a side note to be sure that you use a Critical Section or a Mutex to ensure that one thread is not writing new data to the structure at the same time the other is trying to read it.)
I'm assuming that you do cast the WPARAM back to the correct structure pointer when the message is received by the worker thread.
If checking on this stuff doesn't help, reply to the post, and I'll try to think of other reasons this may be happening.
Jeff
|
|
|
|
|
I got the following message in reply:
Thanx for the ideas !I created a worker thread .I am posting message to this worker thread only ! As you said I am passing the pointer to structure as WPARAM of the message !Now, in the ThreadProc of this worker thread I am typecasting the WPARAM of the message to the structure pointer and retrieve the members of the structure !Here only I am receiving the wrong value for some data members(Of the 11
members the last 4 member values are wrong !)What can be the problem ?I had tried with Mutex & critical section.Still the same problem exists !
How can I overcome this problem ?
Regards,
Y.Yamini Devi
|
|
|
|
|
Yamini,
It depends on how you know the members are wrong. If you are using a byte index into the structure and coming up with the wrong values, or if you are looking into memory locations directly, then the problem may be how the structure is defined. If you don't tell the compiler to pack the structure to 1 byte values then when it builds the structure it may pad spaces onto the end of intermediate values to get the 'correct' block sizes. If you have strutures within the defined 'communication' structure, this problem can be compounded. Check that you use the compiler directive "#pragma pack (1)" around your structures to be sure that the compiler is not adding additional empty bytes. Once all the structures are defined you can use "#pragma pack ()" to return the pack value to its previous setting.
Just a thought
Jeff
|
|
|
|
|
Hi, does anyone knows how I can get the handles to all child-windows of the Active or Foreground window? In WINDOWS CE! I know there is an API call EnumChildWindows, which work perfecly on the desktop, but is not supported on CE... (PocketPC)
Is there an other way to do this?
Greetings
Kasper
|
|
|
|