|
see this link
http://support.microsoft.com/support/kb/articles/Q216/6/38.asp
Nish
Sonork ID 100.9786 voidmain
|
|
|
|
|
|
Hi all, I am back with yet another question (and its really bugging me!). I have successfully implemented some TWAIN support. That is, I can access the device drivers for the scanner etc. and select a device in the event of there being more than one. I can get the device session manager up too, from where I can get preview the picture etc. and I can actually get it to scan the area I want. However, when it comes to getting this image up onto the screen is where I`m having difficulty. I have looked at Rajiv's wrapper on this very web-site, and its really helped me get this far, however his code is very complicated (with v.few comments) when it comes to displaying the image on the screen, and completely differs from the way that I do it in my program. I create a DIBSection from the BITMAPINFO resource (which I can obtain in my program). However, when I try to create a DIBSECTION it returns a HBITMAP and there is merely a black rectangle(the same size and shape as the one I selected using the DSM after the preview). I have probably got the pointer to bits somewhere too amongst the void* I managed to obtain the BITMAPINFO from, but don`t know what I have to do to get at the right ones and get this blinking DIBSection of a scanned image going. Please help.
Cheers guys (for reading all that anyway)
Alan.
AEGC
|
|
|
|
|
how are you creating your DIBSection?
-c
POKE 808,234
|
|
|
|
|
Ruh roh...
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
I have been creating my DIBSections using CreateDIBSection, as you will know this returns a HBITMAP, and any other pieces of info I may want ("the bits" etc.). However, I have got one step closer to finding a solution to this problem and I feel that your on the right lines Chris. I have now assertained a full BITMAPINFO structure (valid from the scanned image), and I even have a pointer to "the bits". However, my program relies on the HBITMAP structure that I need to create, if I use CreateDIBSection, the pointer I supply to the function is overridden and comes back with just black pixel values. Is there any way I can create the HBITMAP using the BITMAPINFO structure I have got and the pointer to "the bits"? I believe this is this problem is now solveable, but how?
Cheers Chris,
Alan.
|
|
|
|
|
can you show us a bit of your code (like where do you get your DCs from, any SelectObject stuff), etc?
=c
POKE 808,234
|
|
|
|
|
OK, I have actually managed to solve the problem, but I`d still appreciate it if you could tell me whether this code is efficient, and if not an alternative approach to solving the problem. The code below is generated from the OnAquisitionClick() function (which does all the TWAIN stuff) and passes the results to the AcquireImage() function, both of which are located in the MainFrame class of an MDI app. right here goes:
void CMainFrame::AcquireImage(HBITMAP hbitmap, TW_IMAGEINFO& info)
{
CBitmapDoc* pBitmapDoc = NewDocument();
CBitmapFrame* pBitmapWnd = (CBitmapFrame*)NewWindow(pBitmapDoc);
BYTE* lpVoid, *pBits;
LPBITMAPINFO pHead;
lpVoid = (BYTE*)GlobalLock(hbitmap);
pHead = (LPBITMAPINFO)lpVoid;
if(pHead->bmiHeader.biCompression != BI_RGB || pHead->bmiHeader.biBitCount != 24)
{
GlobalUnlock(lpVoid);
return;
}
pBits = (BYTE*)lpVoid + sizeof(BITMAPINFOHEADER);
HBITMAP newbitmap = CreateDIBitmap(pBitmapWnd->GetDC()->m_hDC, &pHead->bmiHeader, CBM_INIT, pBits, pHead, DIB_RGBCOLORS);
if(newbitmap)
{
pBitmapDoc->m_hAppliedTools.push_back(newbitmap);
pBitmapWnd->SetMinMaxWndSize(pHead->bmiHeader.biWidth, pHead->bmiHeader.biHeight);
pBitmapWnd->AddDYNAMenu(m_hFilters, m_hTools);
pBitmapDoc->SetTitle("Acquired");
m_hBitmapTemplate->InitialUpdateFrame(pBitmapWnd, pBitmapDoc, TRUE);
return;
}
else
AfxMessageBox("Cannot create new image acquisition graphic");
}
The one thing I do notice is that although I get all my information from hbitmap, if I try to use that Handle, the image is not drawn at all! I think, now that I`ve got this working, I may be able to figure out some better code to the job (I noticed some areas when I was just typing it out). One other thing, hbitmap may have been ascertained from the scanner as a HANDLE and not a HBITMAP (what I mean by that is that I could pass a HANDLE to one of the TWAIN acquire procedures and it still works). The handle is then passed to the procedure above. Hope you can enlighten/reassure me on my code.
Thanks again Chris,
Alan
"When I left you I was but the learner, now I am the Master" - Darth Vader
|
|
|
|
|
Basically what I need to do is convert printing press CMYK colors to display RGB.
What I have been trying to do is this:
1) Get Profiles for display and press. In this case I'm using an RGB profile of CPQV1100.ICM (a Compaq supplied monitor profile) and a CMYK profile of CLC500M7.ICM which is a Canon profile for their color laser printer.
2) With the HPROFILES I then create an HTRANSFORM like this:
LOGCOLORSPACE lcs;
ZeroMemory(&lcs, sizeof(LOGCOLORSPACE));
lcs.lcsSignature = LCS_SIGNATURE;
lcs.lcsVersion = 0x400;
lcs.lcsSize = sizeof(LOGCOLORSPACE);
lcs.lcsCSType = LCS_WINDOWS_COLOR_SPACE;
lcs.lcsIntent = LCS_GM_IMAGES;
hTransform = CreateColorTransform(&lcs, hDestProfile, hTargetProfile, BEST_MODE);
3) I then fill a COLOR record like this
color.cmyk.cyan = 65535;
color.cmyk.magenta = 0;
color.cmyk.yellow = 0;
color.cmyk.black = 0;
4) Then I call:
TranslateColors(hTransform, &color, 1, COLOR_CMYK, &outcolor, COLOR_RGB);
5) The rgb colors in the outcolor structure come nowhere near the input colors.
I would greatly appreciate any help anyone can give in the use of ICM.
Thanks
Andy Brace
SW Development Engineer II
Qwest
A clear conscience is usually the sign of a bad memory.
|
|
|
|
|
Hi,
I'm using Boundschecker 6.2 to track down a tricky memory leakage problem. (It's not actually leaks, the memory is freed correctly - but too late).
The "Memory usage" window lists allocations by malloc/new/CoTaskMemAlloc & SysAllocString, I would need a similar list with the corresponding deletes. Any ideas?
TIA
Peter
|
|
|
|
|
i am trying to compile a test program with the following includes:
#include <sys/types.h>
#include <sys/socket.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <netdb.h>
#include <netinet/ip.h>
#include <netinet/in.h>
#include <netinet/ip_icmp.h>
Do i need to download the SDK for this?
(i am new to VC++...)
|
|
|
|
|
I doubt the program you are trying to compile was written for Windows given the names of some of those includes.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
It looks a lot like Linux or UNIX code with those headers.
Socket programming are *very* different on Windows and *unix...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
I would like to have an external application supply VC++ with a filename and line number (when a user double-clicks in a window in the external app), and have VC++ open the file and go to the file number. Any ideas about how I might send that information and get VC++ to respond to it?
|
|
|
|
|
Search your docs for 'Developer Studio objects', these automation interfaces should allow you to control VC++ from an external application.
Ben Burnett
"It's all absolutely devastatingly true -- except the bits that are lies"
- Douglas Adams
|
|
|
|
|
Thanks! Just what I was looking for. Don't know why I couldn't find this in the docs on my own...
You wouldn't happen to have any example code that shows how to create an instance of the 'Developer Studio objects' in the other app (in C++, not VB)? It seems to have something to do with IRunningObjectTable::GetObject(...), but I'm having trouble putting it all together...
|
|
|
|
|
No sample just a link, take a look at:
Getting the most out of IDispatch
http://www.codeproject.com/useritems/comdispatchdriver.asp
seems to me that it could help you get going in no time flat.
Ben Burnett
"It's all absolutely devastatingly true -- except the bits that are lies"
- Douglas Adams
|
|
|
|
|
Hi!
My code looks like this:
m_PlayWnd = NULL;
if( m_PlayWnd == NULL )
{
m_PlayWnd = MCIWndCreate(this->GetSafeHwnd(),AfxGetInstanceHandle(), WS_CHILD | MCIWNDF_NOMENU, m_File);
}
else
{
MCIWndHome(m_PlayWnd);
}
for(int i = 0; i < 2; i++)
{
MCIWndPlay(m_PlayWnd); // PLAY 3 TIMES!!!!! IT WONT WORK FOR ME!!
}
(It's from BLaZe's VFW code here on CodeProject)
But why wont this play the song 2 times??
HEEELP!!
Give me some advice to write code that can repeat the sound!
------------------------------
CodeCracker - That's me!
------------------------------
|
|
|
|
|
I don't really do music stuff, but aren't you meant to ensure the first play has finished before inniriating the 2nd?
We do it for the joy of seeing the users struggle.
|
|
|
|
|
Try replacing;
MCIWndPlay(m_PlayWnd); with;
MCIWndSM ( m_PlayWnd, MCI_PLAY, MCI_WAIT, 0 );
Ben Burnett
"It's all absolutely devastatingly true -- except the bits that are lies"
- Douglas Adams
|
|
|
|
|
Hi all,
Please tell me how can i Write and Read from cells in FlexGrid ?
I need when user double-click on one of cells, the can edit cell value, how can i do that ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Its a trick. Really flex grid (don't know about its newer versions but I suspect its the same) hasn't got edit boxes, its just a display.
Its a handy thing so there is a little trick worth knowing about.
Lets say you have a FormView with a flexgrid on it and an Invisible EditBox.
When your user changes the selection box in the grid get that boxes current size, and the size of each (visible) box (row and col) before it. Then place your EditBox in the right possition with the correct size , make it vissible and give it the focus. When your user presses <return> or tab copy that data to the box the user had selected and make your EditBox invisible again.
Now that you know this, there is no reason why you can't use other types of edit boxes, take into consideration the limitations of the grid, but a RichEdit box will give you nice easy colo(u)r options.
We do it for the joy of seeing the users struggle.
|
|
|
|
|
hmmm, Yeah !
I think i got your mean ...
You said, FlexGrid have tools only for indicating Text, and haven't tools for inputing ...
and for emulating editing, i must create object from CEdit and show that on cell coordinate ?
Does i got your mean ?
If i have two requests of you:
R1 - Please intrduce to me useful function about working FlexGrid, like:
1- Indicating text ...
2- Getting selected cell ...
3- Get selected coordiante ...
and ...
R2- Do you have example about it ?
Best Regards,
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Please reply !
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Flex Grid is not very flexible (pun!). Just use Dundas Grid Control (Click a banner) or CHris's excellenet grid control that's on this site.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|