|
I'm not sure I'm understanding your problem, but do you have your recvfrom() call in a loop? If you don't, you'll just get one datagram and your thread function will continue to whatever's next.
|
|
|
|
|
I am using Visual c++ NET 2005
After creating report with Crystal report and create field on it(ADO.NET), how can I set DataSource programmatically on ReportDocument?
-- modified at 13:08 Thursday 19th July, 2007
|
|
|
|
|
How to programatically verify that an assembly has been installed in the global assembly cache??
|
|
|
|
|
|
Thanks, it was indeed helpful.
|
|
|
|
|
We have some static libraries created long time back say 10/15 yrs back.
We have build all the libraries in visual studio 2005.
But when we create a managed C++ application and try to use classes from the static libraries , the application just crashes with no traces as to why did the application crash.
Application crashes in dbgheap.c.
the static libraries which we use have reference to ATL as well.
With the same set of project settings if a create MFC application in Visual studio 2005 everything seems to be working fine.
Questions:
1. Is it possible for managed C++ application to use static libraries , if yes then what is to be done.
2.What are the options use a static library in managed code.
|
|
|
|
|
I have not used static linking for years. If it turns out there is some problem with that you might consider turning the libraries into DLLs. We have several projects using old code from DLL libraries that work just fine.
|
|
|
|
|
Ah, I've been reading this forum for months, waiting for a question I could actually answer.
At least, I hope I can answer it. If, when you say "managed C++", you actually mean C++/CLI, then the answer is yes. I have written a couple of test applications that statically link one of my native-code libraries to a C++/CLI application that uses managed code. I had some trouble getting static variables in the library to initialize properly, which caused various crashes. I was an MSDN subscriber at the time, and I got a solution from the MSDN-only forums in a matter of days -- I was impressed.
If you're trying to link to a C++/CLI application and you have static variables in your library, I'd be happy to send you the workaround. If you're using the old Managed C++ or don't have any static variables in your library, then I can't help you, sorry.
|
|
|
|
|
ok, so I am using the function PostMessage(msg, wParam, lParam) TWICE in succession:
if (m_pSelectionDlg->GetSafeHwnd()) {
m_pSelectionDlg->PostMessage(WM_ADDENTITY,wParam, lParam);
static CWnd *pWnd;
if ( (pWnd = FindWindow("MyAppClass",0)) != NULL)
pWnd->PostMessage(WM_ADDENTITY,wParam,lParam);
}
for the first call (#1), wParam = 1 and lParam = 0.
for the second call (#2), I step inside the PostMessage() function and wParam = 0 and lParam = 0. Why?
|
|
|
|
|
I don't believe you
You haven't left out any code that could trash the stack (which is where I presume wParam and
lParam are)?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
Nope, that is the code, as is.
The wParam and lParam values are the same after first (#1) call, but when it goes inside the PostMessage() function, I look at it to see that wParam is zero and lParam is zero.
|
|
|
|
|
1st - sorry for replying to my own post...
2nd - Why do I have to do something like this?? Going into PostMessage() #2, my wParam and lParam values are the same as before.
if (m_pSelectionDlg->GetSafeHwnd()) {
m_pSelectionDlg->PostMessage(WM_ADDENTITY,wParam, lParam);
static CWnd *pWnd;
UINT myWParam;
LONG myLParam;
myWParam = wParam;
myLParam = lParam;
if ( (pWnd = FindWindow("MyAppClass",0)) != NULL)
pWnd->PostMessage(WM_ADDENTITY,myWParam,myLParam);
}
I added the "copy of" wParam and lParam as a test, and voila, the second call to PostMessage() worked and received the correct wParam/lParam values.
This seems too hokey...
|
|
|
|
|
Be careful using UINT and LONG for the types of wparam and lparam.
It's safer to use WPARAM and LPARAM or UINT_PTR and LONG_PTR.
Saves changing it in the future when everything's 64-bit
I still have no idea how your variables could change between the PostMessage calls.
How are you checking....stepping into the API assembly code?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
Yes, setting a break point and then step into PostMessage(). I "tricked it" by making a copy of the variables and then supplying these copies to my second call. I'll check the UINT/LONG, WPARAM, suggestion you mentioned.
Thanks.
Johnny
|
|
|
|
|
john john mackey wrote: I "tricked it" by making a copy of the variables and then supplying these copies to my second call.
hmm ok. I personally would really worry about what's going on there.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I'm sceptical too, would like to see the entire method as well as relevant class members,
and the type definitions (or type definition chains) used for wParam and lParam.
Is there anything special about the method ? or its callers ? is there a chance the method
executes more than once concurrently ?
|
|
|
|
|
Hmmmm... I will have to check on possibility of executing more than once concurrently (it is possible.) However, I tricked it by making a copy of the lParam, wParam variables and supply the copies to the second call to PostMessage().
Thanks for reply and help.
|
|
|
|
|
Hi folks!
This could become a bit lengthy, sorry in advance...
I have created a mixed-mode dll (managed+unmanaged C++, .NET 1.1) that implements a given (unmanaged) C++ interface.
Inside this dll I use some objects from C# assemblies located in the same path as the mixed-mode-dll.
So far, so good, everything works as expected when my dll is loaded into a 3rd-party-application from a local directory (using LoadLibrary() I guess. I can't look into the other app, but I don't see a different way...).
When I put the dll on a network share and have the 3rd-party-app load my dll from there, I get an error 1114 (A dynamic link library (DLL) initialization routine failed).
When I set CAS policies to FullTrust for the network share, the dll can be loaded correctly.
Because our customers usually forget to adjust CAS accordingly and wonder why the 3rd-party application shows an error trying to load our dll, I thought I'd include some security-related checks before trying anything fancy and show a nice info dialog telling the user to adjust CAS if any of these checks fail.
Now the problem is that I can't find a place to put these checks.
Even when I just put an AfxMessageBox() as the very first statement in the very first interface function that's getting called, this message box doesn't show but the 3rd-party-app still gives error 1114
It seems as if there's a problem with loading a depending dll/assembly, but I simply cannot find what's going on. There's nothing in the fusion log for this case, either. "Regular" C#-applications write to the fusion log, but when my dll is loaded, the fusion log seems to completely ignore the fact that assemblies have to be found - no entries whatsoever, even after setting ForceLog to true in the corresponding Fusion registry key.
Can anyone offer an idea why .NET behaves like that or what I could try to diagnose the problem?
Thanks in advance,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
mav.northwind wrote: Can anyone offer an idea why .NET behaves like that
Security
|
|
|
|
|
Yes, I know. Of course. That's what I wrote in the question.
But why exactly? I guess it must be a certain permission that's being denied.
CAS security has to kick in somewhere very early, but i completely fail to see which permission is not being granted so early in the process.
Since you can usually execute .NET code from a network share even with the default CAS policies in place, the general execution of managed code cannot be the reason.
But what else?
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Hello and need help again,
Bros, what are the equivalent of the ff. function:
from Visual Basic:
Dim cancelDelegate As New DownloadCompleteSafe(AddressOf DownloadComplete)
Me.SaveFileDialog1.FileName = Me.txtFileName.Text.Split("/"c)(Me.txtFileName.Text.Split("/"c).Length - 1)
to Visual C++:
???
I got the snippet but its vb. i want it in c++.
Thanks in advance,
Jeof
******************************
I just want to
know everything
|
|
|
|
|
I'll take a stab at it, at least the string part... LOL
//dummy source string (Me.txtFileName.Text)
String ^PathStr = "C:\\TEST\\TEST.EXT";
array<string^> ^SplitStrings = PathStr->Split('\\');
// (Me.SaveFileDialog1.FileName)
String ^FileName = SplitStrings[SplitStrings->Length - 1];
I wonder if I'm even close!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
Or, borrowing from the post below...
using namespace System::IO;
...
String^ PathName = "C:\\TEST\\TEST.EXT";
String ^FileName = Path::GetFileName(PathName);
Mark Salsbery
Microsoft MVP - Visual C++
"Great job team! Head back to base for debriefing and cocktails."
|
|
|
|
|
(via Instant C++):
DownloadCompleteSafe ^cancelDelegate = gcnew DownloadCompleteSafe(DownloadComplete);
this->SaveFileDialog1->FileName = this->txtFileName->Text->Split('/')[this->txtFileName->Text->Split('/')->Length - 1];
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
C++ to C# Converter: converts C++ to C#
C++ to VB Converter: converts C++ to VB
Instant C++: converts C# to C++/CLI and VB to C++/CLI
|
|
|
|
|
thank you very much.
Here`s another want to convert.
Dim theRequest As HttpWebRequest
theResponse = theRequest.GetResponse //theres no GetResponse in C++, what should I do?
Catch ex As Exception
Dim writeStream As New IO.FileStream(Me.whereToSave, IO.FileMode.Create)
Delegate Sub DownloadCompleteSafe(ByVal cancelled As Boolean) //where should i put this? in private or public
emailed you
thanks,
jeoffrey
******************************
I just want to
know everything
|
|
|
|