473,809 Members | 2,731 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

passing the data one function to another function

31 New Member
Hi,



I am retrieving the image from DLL through vc++ dll. Actually Image is retrieving in Callback function of main function. When I writing that image file inside of the Callback function then no problem in retrieving. At the same I want to send the Imagedata to the another function and write the same which cause the error.



Here I given that code,



//Callback function



prResponse prSTDCALL MyGetFileDataFu nction(

prHandle CameraHandle,

prObjectHandle ObjectHandle,

prContext Context,

prProgress* pProgress

)

{

static ofstream out("capture.jp g", ios::out|ios::b inary);


switch( pProgress->lMessage )

{

prUInt8 imgbuffer[1024];


case prMSG_DATA_HEAD ER:

break;

case prMSG_DATA:

for (prUInt32 index = 0; index < pProgress->lLength; index++)

{

imgbuffer[index] = pProgress->pbData[index];

}





PowershotDll::P owershotSdkDll: :Copy(imgbuffer ,pProgress->lLength); //Calling another function and send the data

memcpy(CaptureI mage,imgbuffer, 1024L);

out.write((cons t char*)CaptureIm age,1024L);


break;

case prMSG_TERMINATI ON:

out.close();


break;

}





return prOK;

}



Copy function:

void PowershotSdkDll ::Copy(prUInt8 *pDataBuffer, prUInt32 dataLength)

{

// Byte managedDataBuff er __gc[] = new System::Byte[dataLength];

BYTE managedDataBuff er[1024];


for (prUInt32 index = 0; index < dataLength; index++)

{

managedDataBuff er[index] = pDataBuffer[index];

}

/// Write the data to the memoryStream

//pMemoryStream->Write(managedD ataBuffer, 0, dataLength);

static ofstream out1("Copycaptu re.jpg", ios::out|ios::b inary|ios::app) ;

out1.write((con st char*)managedDa taBuffer, 1024L);

out1.close();


}



I got the image capture.jpg but i didnt get the copycapture.jpg image which contain only 1024 bytes.

How to re-assign the array for every data?

Pleae give your suggestion.
Oct 16 '07 #1
1 1506
krishnasamy
31 New Member
----

Now I have changed my function as follows,

Default declaration:
Expand|Select|Wrap|Line Numbers
  1. static ofstream out("capture.jpg", ios::out|ios::binary);
  2.  
  3. void PowershotSdkDll::Copy(prUInt8 *pDataBuffer, prUInt32 dataLength)
  4.     {
  5.     out.write((const char*)pDataBuffer, dataLength);
  6.     out.close();
  7.  
  8.  
  9.     }
  10.  
In Callback function:
Expand|Select|Wrap|Line Numbers
  1. prResponse prSTDCALL  MyGetFileDataFunction(
  2.     prHandle       CameraHandle,
  3.     prObjectHandle ObjectHandle,
  4.     prContext      Context,
  5.     prProgress*    pProgress
  6. )
  7. {
  8.     /* Display progress */
  9.  
  10.  
  11.         switch( pProgress->lMessage )
  12.         {
  13.             //prUInt8        imgbuffer[1024];
  14.  
  15.  
  16.             case prMSG_DATA_HEADER:
  17.             break;
  18.             case prMSG_DATA:
  19.  
  20.  
  21.  
  22.             PowershotDll::PowershotSdkDll::Copy(pProgress->pbData,pProgress->lLength);        
  23.                     break;
  24.  
  25.             case prMSG_TERMINATION:
  26.  
  27.             break;
  28.         }
  29.  
  30.  
  31.  
  32.     return prOK;
  33. }
  34.  

But I have retrieved the last block image data only. What is the problem?
Oct 17 '07 #2

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

Similar topics

4
3602
by: Amr Mostafa | last post by:
Hello :) I'm trying to write a script that deals with a web service. I'm using NuSoap class. my question is : Can I pass some variables By Reference to the web service and get the result back in my variables ?? note1: I'm not the one who wrote the web service.. so I can't modify
12
6563
by: Kevin Lyons | last post by:
Hello, I am trying to get my select options (courses) passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html I am having difficulty getting the courses to pass the correct option value and then be displayed at the following URL: http://www.dslextreme.com/users/kevinlyons/selectResults.html I am passing countries, products, and courses. The first two display
1
4620
by: Kevin Lyons | last post by:
Hello, I am trying to get all of my form elements passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html to the following URL: http://www.dslextreme.com/users/kevinlyons/selectResults.html I am passing name, email, countries, cities, products, courses, etc. The others display as they should on the subsequent page,
2
2550
by: Richard | last post by:
**** Post for FREE via your newsreader at post.usenet.com **** HI, I am working on a project where I need to input data to a (local) HTML page using multiple form elements, such as text, radio, checkbox, and dropdown. When the form Submit button is clicked, I then need the input data either written to another location on the same page, or written to another page (a different frame would be fine)
58
10190
by: jr | last post by:
Sorry for this very dumb question, but I've clearly got a long way to go! Can someone please help me pass an array into a function. Here's a starting point. void TheMainFunc() { // Body of code... TCHAR myArray; DoStuff(myArray);
11
8134
by: John Pass | last post by:
Hi, In the attached example, I do understand that the references are not changed if an array is passed by Val. What I do not understand is the result of line 99 (If one can find this by line number) which is the last line of the following sub routine: ' procedure modifies elements of array and assigns ' new reference (note ByVal) Sub FirstDouble(ByVal array As Integer()) Dim i As Integer
7
2645
by: Jake Thompson | last post by:
Hello I created a DLL that has a function that is called from my main c program. In my exe I first get a a pointer to the address of the function by using GetProcAddress and on the dll side I make sure that my function is being exported by adding a line to the .def file. This seems to work because when I debug it recognizes the dll and once it hits the function it goes right into the proper location of the dll.
5
2411
by: mshaaban | last post by:
Hello, In my code I have a large static 2D arrays defined as: code: #define LONMAX 1440 #define LATMAX60 480 void main (int argc, char *argv)
8
3510
by: S. | last post by:
Hi all, Can someone please help me with this? I have the following struct: typedef struct { char *name; int age; } Student;
4
5941
by: John Sheppard | last post by:
Hello there I was wondering if anyone could help me, I am trying to pass a typed dataset to a dialoged child form by reference. I have binding sources sitting on the child form. So to refresh them I just set their datasource. I am guessing this is probably what is causing the problem. Is there a better way to do this? Anyway this all works happily and things show up when the record already exists but I have 2 problems ; 1) When I add...
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9601
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10378
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9198
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7653
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5687
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.