|
MaHeSG wrote: May i know the DLL/OCX need to be registered for
FM20.DLL
nave
|
|
|
|
|
|
Dear Friends,
I hav developed an MFC application in Visual Studio 2005 my problem is that the application runs fine in my PC(which has Visual Studio 2005 installed in it).For final code release(i.e to give .exe file to somebody) i should build it in Release mode.Im not able to properly configure the Property Pages.(Though the building is succesfully in Release mode it doesnt run on other pc that doesnt hav visual tool it gives message saying that the application configuration is incorrect)
Im using the following code somewhere in the project:
#using "mscorlib.dll";
using namespcae System;
this requires to be compiled with Common language RunTime Support as: /clr and RunTime Library as /MT. This is creating some problem i think.
Please help me Im not able to properly configure the Property Pages
|
|
|
|
|
You need to install the .Net Framework v2.0 on the other computer.
|
|
|
|
|
Hello All,
I have a timer in my dialog which starts in the function and some process is done and I have called the stop timer as below.
working code:-
<br />
<br />
int OnStart(HWND hwnd)<br />
{<br />
dwLastTickCount = GetTickCount();<br />
SetTimer(hwnd, ID_ELASPED_TIMER, 25, NULL);<br />
pA->start();<br />
KillTimer(hwnd, ID_ELASPED_TIMER);<br />
return 0;<br />
}
Now the problem is timer clock is not displayed on the dialog, once the process is over the timer is displayed.
Can one please tell me how to do 2 process at a time ??? displaying the timer clock on the dialog and doing the process ??
I tried with thread as below its not working what is the error ?? what changes I have to make to thread ??
<br />
<br />
int OnStart(HWND hwnd)<br />
{<br />
HANDLE hr;<br />
hr = CreateThread(NULL,0,(unsigned long (__stdcall *)(void *))WorkerThreadProc,0,0,0);<br />
<br />
return 0;<br />
}<br />
<br />
<br />
UINT WorkerThreadProc(LPVOID Param);<br />
<br />
<br />
UINT WorkerThreadProc(LPVOID Param)<br />
{<br />
HWND hwnd;<br />
<br />
IMyA *pA;<br />
<br />
dwLastTickCount = GetTickCount();<br />
SetTimer(hwnd, ID_ELASPED_TIMER, 25, NULL);<br />
<br />
pA->start();<br />
<br />
KillTimer(hwnd, ID_ELASPED_TIMER);<br />
<br />
return true;<br />
}<br />
Thanking you,
Suresh HC.
|
|
|
|
|
Suresh H wrote: SetTimer(hwnd, ID_ELASPED_TIMER, 25, NULL);
how did u get the handle hwnd in the thread function? As per your code its not valid handle. You need to pass this handle to the WorkerThreadProc from the OnStart function. Modify it as below
int OnStart(HWND hwnd)<br />
{<br />
HANDLE hr;<br />
hr = CreateThread(NULL,0,(unsigned long (__stdcall *)(void *))WorkerThreadProc,(LPVOID)hwnd,0,0);<br />
<br />
return 0;<br />
}
UINT WorkerThreadProc(LPVOID Param)<br />
{<br />
HWND hwnd = (HWND)Param;<br />
<br />
IMyA *pA;<br />
<br />
dwLastTickCount = GetTickCount();<br />
SetTimer(hwnd, ID_ELASPED_TIMER, 25, NULL);<br />
<br />
pA->start();<br />
<br />
KillTimer(hwnd, ID_ELASPED_TIMER);<br />
<br />
return true;<br />
}
nave
|
|
|
|
|
Hi Naveen,
Thank you very much now the thread function is working & the timer is also displayed along with process. I forgot to pass the HWND from onStart function.
Thank you very much,
Suresh HC.
|
|
|
|
|
hi Naveen,
I am getting some problem with the handle HWND & hwnd.
in thread i am trying to extract the Edit box contents but i am getting the junk values, why i am getting the junk values ?? what is wrong in the code ???
same code was working in the OnStart function, when I moved it to thread is not working what is cause ???
<br />
<br />
<br />
UINT WorkerThreadProc(LPVOID Param)<br />
{<br />
HWND hwnd = (HWND)Param;<br />
<br />
<br />
char *FName = new char[20];<br />
HWND HEFName = GetDlgItem(hwnd, IDC_FILE_NAME);<br />
SendMessage(HEFName , EM_GETLINE, 0 ,(LPARAM)FName);<br />
}
output :- ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
|
|
|
|
|
Suresh H wrote: SendMessage(HEFName , EM_GETLINE, 0 ,(LPARAM)FName);
MSDN says
lParam:<br />
Pointer to the buffer that receives a copy of the line. Before sending the message, set the first word of this buffer to the size, in TCHARs, of the buffer. For ANSI text, this is the number of bytes; for Unicode text, this is the number of characters. The size in the first word is overwritten by the copied line.
so u should set the first 2 byte of buffer as size of the array.
char *FName = new char[20];<br />
WORD* pWord = (WORD*)FName;<br />
*pWord = 20;<br />
HWND HEFName = GetDlgItem(hwnd, IDC_FILE_NAME);<br />
SendMessage(HEFName , EM_GETLINE, 0 ,(LPARAM)FName); ]
if the edit control is a single line edit I suggest you to use GetWindowText() function.
nave
|
|
|
|
|
Hi Naveen,
Once again thank you very much for the response.
Now i am getting the values properly. Thank you very much for explanation its very use full.
I had used the same code in the OnStart() and it was working properly ,but how ??
|
|
|
|
|
Suresh H wrote: and it was working properly ,but how ??
may be because the following reason.
When you new some data, the memory allocated contains some junk values. when you call the function from OnStart(), the first two byte might had some valid positive values. Then there is a chance for that function to work properly. Just a guess
nave
|
|
|
|
|
Thanks Naveen for the response.
|
|
|
|
|
In addition to what Naveen said, read this article on creating and dealing with worker threads ->Using Worker Threads[^] There is a sub topic "Worker threads and the GUI II: Don't touch the GUI" that specifically spells out to not to let other threads touch the UI and why its bad.
Best of luck.
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|
|
hi !
i need to pass array of objects in the function by reference. can any one help me ?
i created the following class declaration.
class TagE
{
string x,
string y,
int z,
public :
void foo(TagE & )//? what should i write here?
};
int main()
{
TagE t[25];
// how can i pass t[25] as function argument
foo(t);// what should i write here
}
can any guide me or send me test/demo/example link?
Amit
|
|
|
|
|
amitmistry_petlad wrote: void foo(TagE & )//
u can pass the array to foo by changing the prototype of foo as below
void foo(TagE* );
nave
|
|
|
|
|
but i want to use reference rather then pointer.
|
|
|
|
|
no reference is needed when passing array
when you call as foo( t ), the t is the pointer to the first element to the array so the foo will get the pointer to the original array it self. Its not getting copied.
or else u can define foo as
foo( T array[]);
nave
|
|
|
|
|
<code>
#include <vector>
using namespace std;
class TagE
{
public :
int z;
string x;
string y;
void foo(vector<TagE>& );
};
void TagE::foo(vector<TagE>& vec_tag)
{
cout<<vec_tag.size();
}
int _tmain(int argc, _TCHAR* argv[])
{
vector<TagE>vec_tag;
TagE t1;
t1.z=10;
t1.x ="code";
t1.y="project";
vec_tag.push_back(t1);
t1.foo(vec_tag);
return 0;
}
</code>
Dario: How is "directory" in French? (I mean a file system directory).
John Simmons: "zee file holdaire thingie"
|
|
|
|
|
I think it would be:
void foo(TagE (&the_array)[25]);
although it would be clearer with a typedef:
typedef TagE array_of_25_tage[25];
void foo(array_of_25_tage& the_array);
|
|
|
|
|
Michael Dunn wrote: void foo(TagE (&the_array)[25]);
is there any difference between the above and void foo(TagE the_array[25]); ?
nave
|
|
|
|
|
Consider the case where you assign a new value to the_array inside foo() . When the_array is a reference, the change is visible to the caller. (I'm not positive, this is an area of black-magick syntax that I rarely venture into)
|
|
|
|
|
Ya in that case its ok. Like a double pointer na?
Thanks
nave
|
|
|
|
|
TagE the_array[20];
void foo(TagE the_array[25]);?
foo(the_array);
In this case, you can pass a pointer to the function.
TagE the_array[20];
void foo(TagE (&the_array)[25]);
foo(the_array);
But in this case, you should pass a correct arrary to the function(TagE the_array[25]; ).
|
|
|
|
|
i exactly definded you what i want .
in my DRmClient.cpp file
#include "TagEditor.h"
//// for tageditor class.
TagEditor _ProtectSet[MAX_PATH]; //global object
////
now i had fill up the object run time and try to pass this object to one function below
hr = pkg.EncodeMediaContent(wInFile,w_Output,hDlg,HOST,UserID,sINIT_PACKAGE_RESPONSE,COMMUNICATOR_SCRIPT_FILE_PATH,PORT,hList,_ProtectSet[25] );
the above function call the follwoing function
HRESULT Package::EncodeMediaContent(WCHAR *pszInFile, WCHAR *pszOutFile, HWND hwndParent, string Host,string UserID, string InitPackageRequest,string ScriptFile,INTERNET_PORT Port,HWND hList,TagEditor _ProtectSet[MAX_PATH])
{
//where i again pass that last parameter in other function
string sConfigureResponse = GenerateConfigurePackageRequest(UserID,Host,ScriptFile,Port,hwndParent,InitPackageRequest,w_KeyID,hList,_ProtectSet);
}
string Package::GenerateConfigurePackageRequest(std::string uid,std::string host, std::string scriptFile, INTERNET_PORT port, HWND hwndParent,string sInitPackagingResponse,WCHAR *w_KeyID,HWND hList,TagEditor _ProtectSet[])
{
//and here i am using the original object members
e.g. like
string Title = "";
Title=_ProtectSet[0].title;
// now got it!!.
}
}
Amit
|
|
|
|
|
amitmistry_petlad wrote: hr = pkg.EncodeMediaContent(wInFile,w_Output,hDlg,HOST,UserID,sINIT_PACKAGE_RESPONSE,COMMUNICATOR_SCRIPT_FILE_PATH,PORT,hList,_ProtectSet[25]);
why _ProtectSet[25]? Passing like this means you are passing only the 25th element of the array. Why dont you pass like
hr = pkg.EncodeMediaContent(wInFile,w_Output,hDlg,HOST,UserID,sINIT_PACKAGE_RESPONSE,COMMUNICATOR_SCRIPT_FILE_PATH,PORT,hList,_ProtectSet );
nave
|
|
|
|
|