|
\a makes a beeb for those who have ME and cant use the beep function(like me )
cout<<"beep sound \a";
<marquee>Raffi
|
|
|
|
|
Unplug the keyboard and reboot
|
|
|
|
|
COULD SOMEONE HELP ME OUT AS TO HOW TO WRITE A WRAPPER IN Visual C++ 6 I have a dll (SbLm_LogClient.dll ) written in C which I need to use in my vb code. I guess the DLL functions uses _cdecl convention. I guess the way round it is to write a wrapper in C++ using the __stdcall convention. I know the dll exposes two interfaces.
Interface 1 - SbLm_Log accepts an Integer and a Char
Interface 2 - SbLm_CloseLogClient is a sub, it accepts no parameters
I have an include file from the from the author of the .a and .h file. The content of the .h file is below
#ifdef WINDOWS_NT
#ifndef SbLm_LogClient_h_included
#define SbLm_LogClient_h_included
#ifdef BUILDING_DLL
#define DLLIMPORT __declspec (dllexport)
#else /* Not BUILDING_DLL */
#define DLLIMPORT __declspec (dllimport)
#endif /* Not BUILDING_DLL */
DLLIMPORT int SbLm_Log(int, char *);
DLLIMPORT int SbLm_CloseLogClient();
#endif // SbLm_LogClient_h_included
#else
int SbLm_Log(int, char *);
int SbLm_CloseLogClient();
#endif
|
|
|
|
|
I am developing my own custom ActiveX Control for the first time and I am not sure how to design the GUI for this control using the resouce editor. Do I have to setup my control in code?
Please help.
|
|
|
|
|
I have a serial port class which continously polls the serial port and writes to the serial port as needed. I have a seperate thread for reading from the serial port. My problem is that I created the handle for the serial port in the main thread to be used when writing to the serial port, but I need to use that same handle in the other thread so that I can read from the serial port. I passed the handle to the worker thread, but I can't use it because it's not part of the thread's handle map. How can I get a handle to the serial port in the worker thread?
Mark Lenz
|
|
|
|
|
When I need to make that I use a global Variable with the handle that I need to use.
For example If I have a conecction with a database, I don't use diferent conections for each handle, I put the connection pointer into a global variable, that is acceded for each handle, and this work, i don't Know if you will have any problem with this practice.
I hope to help you...
Carlos Antollini.
Is today Friday?
No Bob!!!
|
|
|
|
|
take a look at DuplicateHandle,
and use 1 handle for writing and the other for reading..
hope this helped
B.Bruggeman
|
|
|
|
|
Does the structure, for example 8 bpp bitmap, goes thus:
Red;
data+=byte;
Green;
data+=byte;
Dark blue;
data+=byte;
// Miss of reserve
data+=byte;
If so, whence to take colours?
Willn't structure RGBQUAD help any more?
I.e. what analog will be to string:
Red = Quad->rgbRed?
There can be I are mistaken?
In what my error?
|
|
|
|
|
No, an 8 bit bitmap has the structure where each byte represents a lookup into the palette, so each colour is represented by one number between 0 and 255, and you need to look up the colour in the palette.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
I understand it. But, how to get it. For 24 and 32 bpp bitmap i use RGBQUAD,
scanline and other. What do i need for 8 bpp bitmap, how to get color for every pixel, if RGBQUAD doesn't work correctly for it.
What do i need to change in this code for 8 bpp?
for( int y = lpBitmap->biHeight; y>0; --y )
{
ScanLine = Bits + (WidthBytes * (y-1));
Data = ScanLine;
for( int x = 0; x<lpbitmap->biWidth - 1; ++x )
{
LPRGBQUAD Quad = (LPRGBQUAD) Data;
Blue = Quad->rgbBlue;
Green = Quad->rgbGreen;
Red = Quad->rgbRed;
BYTE color = (Red + Green
+ Blue)/3;
Data += BytesPerPixel;
}
|
|
|
|
|
I'm not sure how you're accessing your bitmap, but you needc to change the values in the palette. That is why changing a colour on an 8 bit bitmap changes it for the whole thing, because each pixel is not stored as a discrete value. So for this function, you need to lookpu the value in the palette, and get the red/green/blue from there. BTW if you're going for greyscale, you should do this:
grey = .299 * red + .587 * green + .114 * blue
This takes into account thte way the eye percieves each colour.
I'm about to take my kid to the show, but if you're still stuck LMK and I'll try to find some source when I get back.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Thanks for your help, i really need it!
|
|
|
|
|
I work with microscope and i have avi file from surface.
I need intensity of every pixel. I need it for mathematical manipulations with images (filters and other stuff). So, i open avi file and take a frame from avi like
LPBITMAPINFOHEADER lpBitmap = (LPBITMAPINFOHEADER)AVIStreamGetFrame(pVideoFrame, nFrame);
and save it as txt file, which works for 24 and 32 bpp.
But i need 8 bpp and 16 bpp bitmaps (little size)
//Code
int BytesPerPixel = (lpBitmap->biSizeImage)
/(lpBitmap->biHeight * lpBitmap->biWidth);
int WidthBytes = lpBitmap->biWidth * BytesPerPixel;
int size = sizeof(BITMAPINFOHEADER)
+ sizeof(RGBQUAD) * lpBitmap->biClrUsed;
BYTE *Bits = (LPBYTE)lpBitmap
+ size;
BYTE * ScanLine;
BYTE * Data;
unsigned long Red, Green, Blue;
CStdioFile skadr;
CString string;
skadr.Open(filename, CFile::modeCreate|CFile::modeWrite);
for( int y = lpBitmap->biHeight; y>0; --y )
{
ScanLine = Bits + (WidthBytes * (y-1));
Data = ScanLine;
for( int x = 0; x<lpbitmap->biWidth - 1; ++x )
{
LPRGBQUAD Quad = (LPRGBQUAD) Data;
Blue = Quad->rgbBlue;
Green = Quad->rgbGreen;
Red = Quad->rgbRed;
unsigned long color = (Red * 0.299)
+ (Green * 0.587)
+ (Blue * 0.114);
string.Format("\t %d", color);
skadr.WriteString(string);
Data += BytesPerPixel;
}
string.Format("\n" );
skadr.WriteString(string);
}
|
|
|
|
|
The thing you have to consider is, what do you want to achieve ? The way you're writing the file, you're getting an 8 bit greyscale image, if you put this info into an 8 bit bitmap with a palette that went evenly from 0,0,0 to 255,255,255, it would work. You're only writing out one colour value as far as I can see, and you're now correctly calculating the grey value. Therefore making your bitmap 8 or 16 bit internally will only result in messy calculations to get to the same point you're reaching now. Please correct me, but I believe you're writing out one unsigned char per colour, although you're making the variable an unsigned long, it will still be between 0 and 255, yes ?
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
|
|
|
|
|
Yes, it still between 0...255.
And more, i compared it for 24 and 32 bpp with using GetPixel function
BYTE grayValue = (BYTE)(int)((GetRValue(clr) + GetGValue(clr) + GetBValue(clr)) / 3),
and it was the same.
But for 8 bitmap, then i using GetPixel it was like
125 125 125 (Red Green Blue)
and for my code it was
31 31 31
Why? I don't know
Yes, i need grayValue for every pixel
But i don't neen GetPixel(), because it work with handle (hDC, DC and other),
i need information only from bitmap (avi frame->LPBITMAPINFOHEADER)
But i haven't ideas how to wrote simple code for 8 and 16 bpp
|
|
|
|
|
Following the documentation, the ShowHTMLDialogEx() function should
support the Print Template behavior in the loaded HTML.
However, there is no example nor explanation about this feature.
How can I pass the dialogArguments object and its members, like
__IE_BrowseDocument, to the loaded HTML?
|
|
|
|
|
I have a dialog which I use as a toolbar. On this dialog are drawn buttons using the CreateWindow function so that they can be drawn dynamically and they are sent the BM_SETIMAGE so that I can draw a different bitmap on each. This all works fine, I can add and remove buttons anywhere I want on this toolbar dialog. This is probably a really simple question, how do I handle them being pressed?
Thanks for any help in advance,
Nick
|
|
|
|
|
Hi,
How can i determine the size of the disk drive that the c: partition is on?
I know how to get the partition info for drive c:, but i need the whole drive size.
The code needs to work in 95+ and nt+
Thanks for any pointers to info
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Greetings!!!
Please tell me any other good web-sites regarding VC++/MFC, other than the following sites:
www.funducode.com
www.codeguru.com
www.codeproject.com
www.mindcracker.com
cheers...
Imran Farooqui
|
|
|
|
|
Someone at school told me about www.planet-source-code.com, but I dont know if its any good. I havent checked it out yet.
-Raffi
|
|
|
|
|
devx.com
experts-exchange.com
San
|
|
|
|
|
in my program i am reading files, searching for a particular line.. if i find this line i would like to add the line after the line i'm reading..
this whole shebang works well if i use two different files (reading a line, parsing) -> writing this line and the added line if it's the correct one..
if i would like to do this in the same file it doesn't work..
thanks in advance
bernhard
"Politicians and diapers have one thing in common. They should both be changed regularly and for the same reason."
|
|
|
|
|
You can't insert data in the middle of a file, you can either overwrite existing data or append to the end of file. As you have found out, you need two files to "simulate" insertion.
|
|
|
|
|
just to make it sure.. if i want to insert data in the middle of the file i have to make a temp file.. do whatever i want with that file.. and if everyhting is nice i replace the original with the temp file ???
thanks for your answer, a "this helped" for you comes soon
Bernhard
"Politicians and diapers have one thing in common. They should both be changed regularly and for the same reason."
|
|
|
|
|
Yes, basically the method is to copy everything before the insertion point to temp file, write the data to be inserted, and then copy the rest of the original data. If you need to do lots of insertions you should consider using some kind of indexed file structure or a database engine. If that isn't possible, do the insertions in memory and dump only the final data to file.
|
|
|
|