Click here to Skip to main content
16,006,348 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: how to execute an exe file in memory Pin
David Crow1-May-07 5:41
David Crow1-May-07 5:41 
GeneralRe: how to execute an exe file in memory Pin
near2world1-May-07 10:28
near2world1-May-07 10:28 
QuestionRe: how to execute an exe file in memory Pin
David Crow1-May-07 10:35
David Crow1-May-07 10:35 
AnswerRe: how to execute an exe file in memory Pin
near2world2-May-07 4:48
near2world2-May-07 4:48 
GeneralRe: how to execute an exe file in memory Pin
Joan M1-May-07 5:47
professionalJoan M1-May-07 5:47 
QuestionMy thead application gets hang Pin
amitmistry_petlad 30-Apr-07 23:49
amitmistry_petlad 30-Apr-07 23:49 
QuestionRe: My thead application gets hang Pin
sthotakura1-May-07 0:16
sthotakura1-May-07 0:16 
AnswerRe: My thead application gets hang Pin
amitmistry_petlad 1-May-07 0:25
amitmistry_petlad 1-May-07 0:25 
sure dear !
actually i have been waiting for anybody's replay.thanks

well I have made list view in that list view there are suppose some files. I have started the batch mode protection . I have to use threading for that.
how can I do?

the code is below.

hwndListbox=hList; //GetDlgItem(hDlg,IDC_LIST4); //change  the list view to global
				
				LRESULT ListBoxItemCount=ListView_GetItemCount(hwndListbox);													
				int iSelectedFile1=ListView_GetSelectedCount(hwndListbox);

				int  iSelectedFile=SendMessage(hList,LVM_GETNEXTITEM,-1,LVNI_SELECTED);
					

				if(ListBoxItemCount > 0)
				{
		 		
					 for(int i=0;i<ListBoxItemCount;i++)
					 {
						ListView_GetItemText(hwndListbox,i,1,(LPWSTR)&szBuffer,MAX_PATH);
						ListView_GetItemText(hwndListbox,i,3,(LPWSTR)&szBuffer2,MAX_PATH);						
					
						
						string inputFile2= util.ConvertWCHARToString(szBuffer2);
						string filenamewithpath  = util.ConvertWCHARToString(szBuffer);
						string inputFile=inputFile2+"\\"+filenamewithpath;
						

	MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED,inputFile.c_str(),(int)(inputFile.length() + 1),bufferwithpath,MAX_PATH);

									 UINT Iselected=ListView_GetSelectedCount(hList);										

						
						unsigned threadID;
						Utility util;

						string outputfile=PrepareOutputFile(hDlg,util.ConvertWCHARToString(bufferwithpath));
						WCHAR w_Output[MAX_PATH];//=util.ConvertStringToWCHAR(outputfile); 
MultiByteToWideChar(CP_ACP,MB_PRECOMPOSED,outputfile.c_str(),(int)(outputfile.length() + 1),w_Output,MAX_PATH);
						struct argument_list l;
											 
						 l.pszInFile=bufferwithpath; 
						 l.pszOutFil=w_Output;
						 l._ProtectSet=_ProtectSet;
						 l.hList=hList;
						 l.Host=HOST;
						 l.hwndEncrypt=hwndEncrypt;
						 l.hWndinoutfiledir=hWndinoutfiledir;
						 l.hwndParent=hDlg;
						 l.InitPackageRequest=sINIT_PACKAGE_RESPONSE;
						 l.Port=PORT;
						 l.ScriptFile=COMMUNICATOR_SCRIPT_FILE_PATH;
						 l.UserID=UserID;

						
						  <big>hThread=(HANDLE)_beginthreadex(NULL, 0, &Thread ,&l,NULL, 0);</big>										
					
					 }

					 	WaitForSingleObject( hThread, INFINITE );
				
















unsigned __stdcall Thread(void* pArguments )
{
	HRESULT hr;
	struct argument_list *Lparam= (argument_list *)pArguments ;
	Package pkg;
	//::WaitForSingleObject( hThread, INFINITE );
	//::waitfor
	<big>hr=pkg.EncodeMediaContent(Lparam->pszInFile,Lparam->pszOutFil,Lparam->hwndParent,Lparam->Host,Lparam->UserID,Lparam->InitPackageRequest,Lparam->ScriptFile,Lparam->Port,Lparam->hList,Lparam->_ProtectSet,Lparam->hWndinoutfiledir,Lparam->hwndEncrypt);  </big>  //The above function send request to the sever and that http response back in hr=s_ ok form.
	if(hr==S_OK)
	{
	
	MessageBox(0,L"thread gone finished" ,L"therad",0);
	_endthreadex( 0 );    	
	}
	return 0;
}


"Success lies not in the result , But in the efforts !!!!!"
Amit Mistry - petlad -Gujarat-India

GeneralRe: My thead application gets hang Pin
Mark Salsbery1-May-07 5:55
Mark Salsbery1-May-07 5:55 
GeneralRe: My thead application gets hang Pin
Mark Salsbery2-May-07 5:06
Mark Salsbery2-May-07 5:06 
GeneralRe: My thead application gets hang Pin
Mark Salsbery2-May-07 5:34
Mark Salsbery2-May-07 5:34 
QuestionCan this generate a memory leak? Pin
Joan M30-Apr-07 23:40
professionalJoan M30-Apr-07 23:40 
AnswerRe: Can this generate a memory leak? Pin
Stephen Hewitt1-May-07 1:21
Stephen Hewitt1-May-07 1:21 
GeneralRe: Can this generate a memory leak? Pin
Joan M1-May-07 1:27
professionalJoan M1-May-07 1:27 
AnswerRe: Can this generate a memory leak? Pin
James R. Twine1-May-07 2:29
James R. Twine1-May-07 2:29 
QuestionSplitbars in VC++ Pin
neha.g3030-Apr-07 23:05
neha.g3030-Apr-07 23:05 
QuestionRe: Splitbars in VC++ Pin
Mark Salsbery1-May-07 5:57
Mark Salsbery1-May-07 5:57 
Questionthis code runnig in DOS C++, but don't running borland C++ 6 Pin
oz-gur30-Apr-07 23:01
oz-gur30-Apr-07 23:01 
AnswerRe: this code runnig in DOS C++, but don't running borland C++ 6 Pin
toxcct30-Apr-07 23:27
toxcct30-Apr-07 23:27 
QuestionDoes virtual function really influence the performance? Pin
code_discuss30-Apr-07 22:38
code_discuss30-Apr-07 22:38 
AnswerRe: Does virtual function really influence the performance? Pin
Arman S.1-May-07 1:30
Arman S.1-May-07 1:30 
QuestionHow we can make a tooltip for a button Pin
mt_samiei30-Apr-07 21:41
mt_samiei30-Apr-07 21:41 
AnswerRe: How we can make a tooltip for a button Pin
Hamid_RT30-Apr-07 21:47
Hamid_RT30-Apr-07 21:47 
GeneralRe: How we can make a tooltip for a button Pin
mt_samiei30-Apr-07 22:05
mt_samiei30-Apr-07 22:05 
QuestionAVI file to play using Animation control Pin
YUANGE30-Apr-07 20:51
YUANGE30-Apr-07 20:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.