473,386 Members | 1,708 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

C++ Calling Out Arguments inside the Functions and its funcion it'self

I would like to get the value of argument and its output from function as per below.

Expand|Select|Wrap|Line Numbers
  1. LPCWSTR fileName = _T("C\\Test.bmp"); 
  2. unsigned char *Content, Mem;
  3. HBITMAP bitmap;
  4.  
  5. bitmap = LoadBMPFromFile(fileName, Content);
  6. Mem = Content;
  7.  
  8. HBITMAP Dlg::LoadBMPFromFile(LPCWSTR fileName, unsigned char *Content)
  9. {
  10.       HBITMAP hBitmap = (HBITMAP)LoadImage(NULL, fileName,IMAGE_BITMAP,0,0,LR_DEFAULTSIZE|LR_LOADFROMFILE);
  11.  
  12.    BITMAP m_sbmpBitmap;
  13.    CBitmap m_bmpBitmap;
  14.  
  15.     datasize = m_bmpBitmap.GetBitmapBits(datasize * sizeof(COLORREF), lpClrData);
  16.  
  17.     for(int i = 0;i<m_sbmpBitmap.bmHeight;i++)
  18.     {
  19.           for(int k = 0;k<m_sbmpBitmap.bmWidth;k++)
  20.           {
  21.                   char *Mem = temp.put(k,i, 3);
  22.             }
  23.    }
  24.  
  25.     Content = (unsigned char*)Mem;
  26.     return hBitmap;
  27. }
  28.  
Please advise me to get it done since I left this function only for my development and looking forward to hearing from good news from someone.
Mar 8 '10 #1
3 1994
johny10151981
1,059 1GB
can you post the code in code format

at the top of the code
LPCWSTR fileName = _T("C\\Test.bmp");
the given path is wrong in that case your program will try to find the file
"dir_of_the_executable\c\Test.bmp"

but I guess you are trying to pu
C:\Test.bmp
Mar 8 '10 #2
Hi,

Here is my draft code and I think one input argument and mulitple output arguments couldn't be possible using C++ funcitons.

Expand|Select|Wrap|Line Numbers
  1. // main.cpp 
  2. BOOL Dlg::Start()
  3.      LPCWSTR fileName = _T("C\\Test.bmp");      // same as C:\Test.bmp 
  4.      unsigned char *Content, Mem; 
  5.      HBITMAP bitmap; 
  6.  
  7.      bitmap = LoadBMPFromFile(fileName, Content); 
  8.      Mem = Content; 
  9.  
  10.      // display image from Mem
  11.  
  12. }
  13.  
  14. HBITMAP Dlg::LoadBMPFromFile(LPCWSTR fileName) 
  15.       HBITMAP hBitmap = (HBITMAP)LoadImage(NULL, fileName,IMAGE_BITMAP,0,0,LR_DEFAULTSIZE|LR_LOADFROMFILE); 
  16.  
  17.    BITMAP m_sbmpBitmap; 
  18.    CBitmap m_bmpBitmap; 
  19.  
  20.     datasize = m_bmpBitmap.GetBitmapBits(datasize * sizeof(COLORREF), lpClrData); 
  21.  
  22.     for(int i = 0;i<m_sbmpBitmap.bmHeight;i++) 
  23.     { 
  24.           for(int k = 0;k<m_sbmpBitmap.bmWidth;k++) 
  25.           { 
  26.                   char *Mem = temp.put(k,i, 3); 
  27.             } 
  28.    } 
  29.  
  30.     Content = (unsigned char*)Mem; 
  31.     return hBitmap; 

Expand|Select|Wrap|Line Numbers
  1. // main.h
  2. // Image Display and BufferMemory
  3. typedef struct Image
  4. {
  5.      HBITMAP hBitmap;
  6.      unsigned char *bufMem;
  7. }Image;
  8.  
I would like to return HBITMAP and unsigned char* from the function LoadBMPFromFile to main.cpp. I am trying with structure to settle this issue and hoping from someone's advice soon.

Best regards
Mar 9 '10 #3
Banfa
9,065 Expert Mod 8TB
KYAW KYAW OO,

please start posting your code inside [code]...[/code] tags. It makes it easier to read. This is the second time I have asked you to do this if you continue breaking forum posting guidelines you will begin getting infractions, if you get enough infractions you will get an initially temporary ban from the forum.

Banfa
Administrator
Mar 9 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Daniel Nouri | last post by:
The idea of my simple piece of code is to start from a given module and wrap all functions and methods in that module and submodules. FunWrapper is the class that I use for wrapping. The last...
8
by: Matthew Bell | last post by:
Hi, I've got a question about whether there are any issues with directly calling attributes and/or methods of a threaded class instance. I wonder if someone could give me some advice on this. ...
22
by: mirandacascade | last post by:
When I look at how classes are set up in other languages (e.g. C++), I often observe the following patterns: 1) for each data member, the class will have an accessor member function (a...
15
by: Ralf W. Grosse-Kunstleve | last post by:
****************************************************************************** This posting is also available in HTML format: http://cci.lbl.gov/~rwgk/python/adopt_init_args_2005_07_02.html...
1
by: Greg Phillips | last post by:
Hello everyone, I have read the section on templates in The C++ Programming Language 3rd edition 3 times over the last 4 days. Still I am stumped. I'll explain a bit about what I am doing...
4
by: Umut Tezduyar | last post by:
I want to use my custom control (.cs) in my web application. Custom control is in the same assembly as my application. I want to know the name of the assembly (.dll) file so i can add it's...
7
by: Andrew Robert | last post by:
Hi Everyone, I am having a problem with a class and hope you can help. When I try to use the class listed below, I get the statement that self is not defined. test=TriggerMessage(data) var...
10
by: Xah Lee | last post by:
there's a HTML odditity. That is, line break will be ignored inside <preif the adjacent lines are tags. see the source code and description here: http://xahlee.org/js/linebreak_after_tag.html...
3
by: jackchang1 | last post by:
hi I recently found this interesting question but I can't answer it. So if I didn't define a variable in my code, and I will get an undefined error for using the variable by calling "argName"....
6
by: Twisted Soul | last post by:
Hey whats the code to get a C++ program to copy its self to. So far ive done some looking into this topic and i have to some how get it in these parts. All users:...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.