|
'some problem' does not give us much to go on. for starters, try making it an unsigned char buffer, a char buffer has a maximum value of 127. What is GetObject ? Also, bitmap.bmWidth * bitmap.bmHeight will give you the number of bits in a word aligned, one bit image ( that has only two colours ). You need to multiply by your bit depth and you need to add a stride value to the width before multiplying. My articles on Image Processing show how to calculate stride.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
The GetObject function requires a HBITMAP handle rather than the path to where the image is found. In order to get a HBITMAP handle you will need to load the image into a bitmap object. If you simply want to send the bitmap to another computer via a socket, you do not even need to load the bitmap into a HBITMAP object. This is used for displaying and manipulating the bits of the image.
All that you will need to do is open the file where the image is located, read the file data into memory, then use that memory buffer to send your image across the socket.
Here is an example:
<br />
HANDLE hFile = ::CreateFile("\\Windows\\Start Menu\\front2.bmp", GENERIC_READ, NULL, OPEN_EXISTING, 0, 0);<br />
if (INVALID_HANDLE_VALUE == hFile)<br />
{<br />
}<br />
DWORD FileSize = ::GetFileSize(hFile, NULL);<br />
BYTE *pbBuffer = new BYTE[FileSize];<br />
if (!pbBuffer)<br />
{<br />
}<br />
::ReadFile(hFile, pbBuffer, FileSize, &Bytes, 0);<br />
After you execute that code, pbBuffer will contain all of the data in the bitmap file and you can use that to send it over the socket. After you send it you will need to call delete[] pbBuffer;
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
In your example nBmpsize size may be invalid - it does not take bit depth into account, along with line alignments that may also be the case. See articles in the Code Project's Bitmap section.
Regards,
Bartosz Bien
|
|
|
|
|
if I have an url is there any function that can help me get the hostname.
E.g from http://www.microsoft.com/anypage/anypage2.html
I would like to get only www.microsoft.com part.
I could not find such an API but maybe somone knows.
Thanks in advance.
Orcun
|
|
|
|
|
One solution is a string function or algorithm to extract the sub-string you want. Do you store it in a string object or is it an array?
For a string object, use the find() functions. For an array, you could use strstr() and the like.
Kuphryn
|
|
|
|
|
I've never used it, but have a look at the InternetCrackUrl() function.
Jon Sagara
Help me out here, Spock. I don't speak stupid.
|
|
|
|
|
InternetCrackUrl() or, if you're using MFC, AfxParseURL() is a bit easier to use.
--Mike--
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
I will not lie to you. I am a Visual Basic programmer. I have been for years. However, I have been tasked with developing an autorun application for our CD publications. Naturally, this is not possible in Visual Basic because of the runtime file requirements. A post at vbexplorer.com informed me of this, and went on to say that the best way to develop such an application would be to use Visual C++.
My first response: “YUCK!”. I can be completely honest when I say that I hate C++. And even as one in the development field I strive to avoid it at all costs. I hardly understand the basics of console application (cin>>) development in it and thus realize it is going to be a monumental struggle to complete this task.
So here I am, asking, begging rather, for help. Here is what I need:
An application that:
a. Loads a form on the screen, which takes up the screens width/height parameters.
b. It must have at least the “X” close button to allow the annoyed users to bypass the autorun features.
c. It needs to have a background image, a bitmap, set to a specified file location.
d. It needs two buttons:
a. one that opens an internet location (without preference to browsers)
b. one that opens a setup exe file (location will be in same directory as the program)
e. Must be editable in Visual C++ 6.0
That’s about it. Is there any chance for help out there? Can anyone toss a quick sample together for me. That is really all that I need to take a crack at this.
In High School I had a VC++ course but it was real basic stuff. And in college I know I am credit packing my way away from having to take it. I KNOW I will need to learn it sometime, but this would sure be a big help in getting me started.
Note: Please comment; heavily, no wait, over comment it.
Thanks,
Erik J. Long
|
|
|
|
|
If you don't know cout sin stuff like that, forget about creating a win32 application( its easy) but not for a "newbie".
I would ask a pro or someone with experience to create the autorun feature.
But what your asking is fearly simple and could be created in few hours.
|
|
|
|
|
I know the basic functions of C++
cin, cout, that's nothing.
I need something to go on.
|
|
|
|
|
autorun is very easy. create a win32 app, and call the shellexecute function to the setup program on your disk. then place a autorun.ini file on the disk. if you need more the code, i can post it because it is only about 10 lines.
|
|
|
|
|
I sure can't think of any reason a program that is launched by autorun canot be written in VB. Try it and see.
Create a .exe file.
Place its name in a file named autorun.inf
Like this
[autorun]
open = MyVBApp.exe
|
|
|
|
|
Hi !
But, what about the VB Runtime DLL ? If the user don't have it installed, how will the VB App be able to launch ?
Jerome
|
|
|
|
|
That's a good point. In that case, VB won't work. Although the same is true of any other .exe that has external dependencies that might not be installed. (like common control library or an old version of the ole libs.)
Reading the post more closely, the users is simply describing a typical install program. Use the MS windows installer or InstallShield or Wise or any one of a number of other products to build such an install process.
|
|
|
|
|
Xxx.xxx is createdfile.
in autorun.ini file, write
[autorun]
open=xxx.xxx (if only xxx=exe)
ico=path(if u want to add ico)
or
[autorun]
open=start xxx.xxx(if xxx=bat,txt,...)
//start is the command of cmd.exe
|
|
|
|
|
|
Hi.
Any tutorial or help docs anywhere on how to create a simple Non MFC Win32 program that can connect to a mySQL database and show/send/delete data from the database?
Thanks for anyhelp.
|
|
|
|
|
|
My previous question was my mistake -- of course!
Now I'm setting up a Win32 app as an empty project and then adding 3 files from a game text book.
I get 1 link error:
blackbox.obj : error LNK2001: unresolved external symbol _DirectDrawCreateEx@16
Does this msg mean it can't find ddraw.lib|h?
I'm using VC 6.0 under Windows 98. The program uses directX and I have version 8.1.
I have entered ddraw.lib|h and the other directX files on
Project Settings->Link Tab->Object/library modules.
What am I doing wrong?
Al
|
|
|
|
|
Have you installed the directx sdk ? or only the directx runtime?
Signature space for rent. Apply by email to....
|
|
|
|
|
No, it doesn't mean that VC can't find some file. It mean that it haven't found this function while linking code. It is probably caused by different calling convention of function in header file and in lib file (it seems that in header calling convention is stdcall and in lib is different). Try to find this function declaration in header file, it should be declared with WIN_API macro. After that find DirectDrawCreateEx in lib file. If it doesn't equal to _DirectDrawCreateEx@16 it can't work (then try to delete WIN_API from the declaration of the function, it should help unless the function is defined in lib using another calling convention: fastcall instead of cdecl. If it is defined with fastcall try to declare it with fastcall (but I don't which macro does this )
Greetings
Mariusz Popiolek
|
|
|
|
|
Anyone have any experience of writing a C++ app that has methods that get called when a cell (or cells) in an open Excel worksheet get changed ?
I have been looking here and not found much (and of course, so far MSDN searching hasn't turned up much, but I am still looking...)
Thanks
¡El diablo está en mis pantalones! ¡Mire, mire!
|
|
|
|
|
Try looking for automation and excel and MFC, for some hints. I've done something similar to this, monitoring some events. An alternative if it's for a specific workbook is to have some VBA event handling in the workbook.
Steve S
[This signature space available for rent]
|
|
|
|
|
Try looking for automation and excel and MFC
Yeah I tried this, and didn't (so far) bring up much useful but I will keep looking.
The VBA is a good point - I could have the vba event handler call out to a COM server I create and then have the server do the rest of the work that needs to happen.
Thanks
¡El diablo está en mis pantalones! ¡Mire, mire!
|
|
|
|
|
I spawn a CDialog derived class from my MDI view. I have a member array in the View m_fields[10] . I want to transmit this info to the dialog. If I declare a member array in the dialog called dialogFields[10], how can I from the view class fill it in after creating the object? (It will be modal so no create())
Is this legal? Is there a better way? I'm looking for the simplest mechanism, but am open to more sophisticated techniques for trannsmitting the array info. BOth member arrays are public.
CMyDlg myDlg;
for (int i =0; i < 10; i++)
{
myDlg.dialogFields[i] = m_fields[i];
}
Appreciate your help,
ns
|
|
|
|