|
Pierre Yves Troel wrote:
I wanted my application to start in a window in dedug mode and fullscreen in release mode.
That's a different story.
Just pass /debug, or /windowed along in the cmdline, depending on how you start the app, and act accordingly in your code.
PS : a debuggable DirectX app should be able to be switched from and to fullscreen at any moment, not only because you are in debug mode or not. That's one of the nice things about IDirectDraw, and that's only a line of code away. (I know it works fine since I did for an app 5 years ago).
|
|
|
|
|
How can I use a licensed windows forms control on a web page?
The only example I can find sugests using a .license file and:
<LINK REL="licenses" HREF="page.htm.licenses">
I have a good license file however I can not get it to work using the line above and can not find any documentation for rel="licenses" in the line above.
The .htm file also contains an object tag:
<object id="ctrl" height="472" width="488" classid="http:MyControl.dll#MyControls.Control" VIEWASTEXT />
which works perfectly with an unlicensed control.
Has anyone ever tried this?
Nigel
|
|
|
|
|
I have a little problem working with the ShouldSerializeMyProperty methods to tell the code serializer of the designer when to serialize my property. I need some complex conditions so I cannot use the DefaultValueAttribute.
I tried the following code:
public class MyForm : Form
{
public MyForm()
{
this.extraColor = Color.Red;
this.extraValue = 0;
this.layerData = new LayerData();
}
public Color ExtraColor
{
get { return this.extraColor; }
set { this.extraColor = value; }
}
bool ShouldSerializeExtraColor()
{
Color color;
if (this.extraValue == 0) color = Color.Red;
else color = Color.Blue;
return !(this.extraColor == color);
}
public int ExtraValue
{
get { return this.extraValue; }
set { this.extraValue = value; }
}
bool ShouldSerializeExtraValue()
{
return !(this.extraValue == 0);
}
private int extraValue;
private Color extraColor;
}
Then I inherited MyForm in the following way:
public class Form1 : MyForm { ... }
When I opened Form1 in the designer and changed ExtraValue to 1 (from 0) then it gets serialized, but ExtraColor doesn't (it should serialize with a value of Color.Red ). Then I changed ExtraColor to Blue and it gets serialized (though it shouldn't). It looks like the ShouldSerializeMyProperty is not executed dynamically, but hardcoded or something.
The most interesting of all is that I tried doing the same thing with a Panel (inheriting Panel to create MyPanel , and then MyPanel to create Panel1 ) and it worked as it should when I place a Panel1 on a Form and change the properties as explained before.
I also tried to attach another Visual Studio as a debugger to the serialization process. I put a breakpoint inside the ShouldSerializeExtraColor method, and when I tried it with the Panel version it gets called and returned the correct boolean value. When I tried it with the Form (as in the previous code) I found out that the ShouldSerializeExtraColor doesn't even get called
I really would appreciate help with this problem..
Sorry for the long post.
Uriel
|
|
|
|
|
I have read that the method can be private but it can not.
Make it public and also you can use
DefaultValueAttribute( typeof( Color ), "Red" )
Hope that this works.
|
|
|
|
|
Hi, Bo! Thank you for answering. As you can see in the example I can't use DefaultValue because I need dynamic conditions.
As for the private or public of the ShouldSerializeMyProperty, I should tell you that I tried them both and they work the same (or rather they don't work). What I cannot understand is why this whole deal works on a Panel (even if the ShouldSerialize is private).
Thank you anyway for giving it a shot. If you have any ideas please answer me. I'm desperate now for finding an answer to this puzzle.
Uriel
|
|
|
|
|
If I would subscribe to only one .NET developer magazine (paper), which one should that be? And why?
|
|
|
|
|
How do you get the count of the currently executing objects in a COM+ application. I need to track the number of objects currently running as the objects are created and destroyed.
I have been looking at the COM+ Administration Collections, and so far it seems that most of the collections are not for the live objects (objects currently running). Where else should I be looking?
Thanks
Gaul
Gaulles
|
|
|
|
|
I need to copy and send the data in a private structure from an MFC app to a .NET app. Somehow, the following does not seem to work. When I use the WM_COPYDATA windows message as indicated below, it is not being received by the WndProc on the .NET side, but when I use a private message, it is received. Unfortunately, when I use the private message, the data seems not to be copied across and I get an assertion error for null data. WM_COPY is not received on the .NET side, but when a private message is used, it is received but then Marshal.PtrToStructure asserts reporting a null value.
Using COM interop is not an option. The client thinks that COM will slow things down as the function is called thousands of times.
Does any one have a suggestion, or a better approach?
Thanks
Gaul
****************************
ON THE MFC SIDE
****************************
////////////////////////////////////////////////////////////
// Increment is called on the MFC side
/////////////////////////////////////////Increment Counter
long CTSPerfMon::Increment(int objectID, int instID)
{
_msg.nMsgID = TS_MSG_INCREMENT;
_msg.nObjectID = objectID;
_msg.nInstID = instID;
_msg.nValue = -1;
return SendMessage();
}
// Send Message across to the .NET side module
long CTSPerfMon::SendMessage()
{
// Fill the WIN32 COPYDATASTRUCT structure
_copyData.dwData = _nPerfMsg; // Message identifier
_copyData.cbData = sizeof(_msg); // size of data
_copyData.lpData = &_msg; // data structure
// Call function, passing data in &_msg
long nRetCode = -1;
if ( _hPerfWnd != NULL )
{
HWND hWnd = GetForegroundWindow();
if (hWnd == NULL)
hWnd = GetDesktopWindow();
nRetCode = ::SendMessage( _hPerfWnd,
WM_COPYDATA, //private message works here
(WPARAM)(HWND) hWnd, //windows sending the data
(LPARAM)(LPVOID) &_msg);
}
return nRetCode;
}
****************************
ON THE C# .NET SIDE
****************************
protected override void WndProc(ref System.Windows.Forms.Message m)
{
if (m.Msg == (int) Msgs.WM_COPYDATA)
{
COPYDATASTRUCT copyData = (COPYDATASTRUCT) Marshal.PtrToStructure(m.LParam, typeof(COPYDATASTRUCT));
if ((object) copyData != null)
{
IntPtr nPerfMsg = copyData.dwData;
if (nPerfMsg.ToInt32() == _nPerfMsg)
{
TSMSG msg = (TSMSG) Marshal.PtrToStructure(copyData.lpData, typeof(TSMSG));
int nRetCode = ProcessMessage(ref msg);
m.Result = (IntPtr) nRetCode;
return;
}
}
}
base.WndProc(ref m);
}
Structure definition on the MFC C++ side
----------------------------------------
#ifdef __cplusplus
extern "C" { // Assume C declarations for C++
#endif
typedef struct tagTSMSG
{
int nMsgID;
int nObjectID;
int nValue;
int nInstID;
}TSMSG;
#ifdef __cplusplus
} // End of extern "C" {
#endif // __cplusplus
Structure definitions on the .NET side:
--------------------------------------
[StructLayout(LayoutKind.Sequential)]
public struct TSMSG
{
public int nMsgID;
public int nObjectID;
public int nValue;
public int nInstID;
}
[StructLayout(LayoutKind.Sequential)]
public struct COPYDATASTRUCT
{
public IntPtr dwData;
public int cbData;
public IntPtr lpData;
}
Gaulles
|
|
|
|
|
What type of support does the NET framework offer for 3D applicatuions. I am interested in creating 3 dimentional applications and was going to primarily use Director MX but wanted to check out about it with C# first.
Thanks.
|
|
|
|
|
Managed DirectX 9
I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
|
|
|
|
|
I can't seem to find any good books on this subject. Would you know of that?
Thanks
|
|
|
|
|
Hi,
I'm getting a System.ArgumentException trying to call the following
IActiveDesktop method:
STDMETHOD (AddDesktopItem)(THIS_ LPCCOMPONENT pcomp, DWORD dwReserved) PURE;
This is how I'm marshaling the call.
void AddDesktopItem(
[In, MarshalAs( UnmanagedType.LPStruct )] COMPONENT pcomp,
[In] int dwReserved
);
I believe the problem is with marshaling the COMPONENT structure. Could
some one point out to me if I'm marshaling the nested structures correctly.
Here is the original typedef for the struct and my c# attempt at marshaling
it.
typedef struct _tagCOMPONENT
{
DWORD dwSize; //Size of this structure
DWORD dwID; //Reserved: Set it always to zero.
int iComponentType; //One of COMP_TYPE_*
BOOL fChecked; // Is this component enabled?
BOOL fDirty; // Had the component been modified and not
BOOL fNoScroll; // Is the component scrollable?
COMPPOS cpPos; // Width, height etc.,
WCHAR wszFriendlyName[MAX_PATH];
WCHAR wszSource[INTERNET_MAX_URL_LENGTH]; //URL of the component.
WCHAR wszSubscribedURL[INTERNET_MAX_URL_LENGTH]; //Subscrined URL
DWORD dwCurItemState; // Current state of the Component.
COMPSTATEINFO csiOriginal;
COMPSTATEINFO csiRestored; // Restored state of the component.
}
COMPONENT;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode )]
public class COMPONENT
{
public int dwSize; // Size of the structure.
public int dwID; // Reserved. Set to zero.
public COMP_TYPE iComponentType;
[MarshalAs( UnmanagedType.Bool )]
public bool fChecked;
[MarshalAs( UnmanagedType.Bool )]
public bool fDirty;
[MarshalAs( UnmanagedType.Bool )]
public bool fNoScroll;
[MarshalAs( UnmanagedType.Struct )]
public COMPPOS cpPos;
[MarshalAs( UnmanagedType.ByValTStr, SizeConst = 260 )]
public string wszFriendlyName;
[MarshalAs( UnmanagedType.ByValTStr, SizeConst = 2083 )]
public string wszSource;
[MarshalAs( UnmanagedType.ByValTStr, SizeConst = 2083 )]
public string wszSubscribedURL;
public ITEM_STATE dwCurItemState;
[MarshalAs( UnmanagedType.Struct )]
public COMPSTATEINFO csiOriginal;
[MarshalAs( UnmanagedType.Struct )]
public COMPSTATEINFO csiRestored;
}
StructLayout( LayoutKind.Sequential )]
public class COMPSTATEINFO
{
public int dwSize;
public int iLeft;
public int iTop;
public int dwWidth;
public int dwHeight;
public ITEM_STATE dwItemState;
}
[StructLayout(LayoutKind.Sequential)]
public class COMPPOS
{
public int dwSize;
public int iLeft;
public int iTop;
public int dwWidth;
public int dwHeight;
public int izIndex;
[MarshalAs( UnmanagedType.Bool )]
public bool fCanResize;
[MarshalAs( UnmanagedType.Bool )]
public bool fCanResizeX;
[MarshalAs( UnmanagedType.Bool )]
public bool fCanResizeY;
public int iPreferredLeftPercent;
public int iPreferredTopPercent;
}
|
|
|
|
|
Hi,
I've written a client/server application using remoting.
This works fine locally / on a LAN / and over the internet, but it fails
when the client is behind a firewall or router.
The internet clients can connect to the server and run stuff, but when they
subscribe to an event, these events are not received (and the server bombs
out trying to send the event).
My understanding is that when a client subscribes to an event, it listens on
a self assigned port for these events which are fired... the details of this
port are sent to the server, so that it knows where to send these events.
However, the IP address of the client machine isn't an external IP address,
it's local to their LAN, and any outgoing requests are routed through their
network's external address.
So, when the server tries to send back to the client, it has an address of
192.168.0.1 or whatever.
Is there some way to tell remoting that the client (or as it becomes a
server when it is waiting for an event) that it is behind a firewall..
here's the address of it.
I've tried setting the machineName property of the http channel, but it
still failed, although I feel like I might be barking up the right tree.
Can anyone help please???
Rich.
|
|
|
|
|
Rich,
Check out Ingo Ramners .NET Remoting site at: http://www.ingorammer.com/Software/OpenSourceRemoting/BiDirTcpChannel.html
His Bidirectional channel will solve the problem you are having of getting events when behind a firewall.
Good luck,
John
|
|
|
|
|
Thank You, this is the first piece of useful information I've found on this subject after almost a week of searching the internet / forums. I've literally just bought Ingo's book, and was hoping that would explain it all to me.
Thanks again.
Rich.
|
|
|
|
|
Hi Richard,
Ingo's book has been very helpful to me. Also be sure to check out the Remoting newsgroup at
microsoft.public.dotnet.framework.remoting
Also check out http://test.labdotnet.com/GenuineChannels/GenuineChannels.html
Its a commercial product which includes a bidirectional TCPIP channel that also includes compression and more. Only $49 and includes source. I have tried his demo and will be purchasing the full product shortly. Looks like a good value for $49.
John
|
|
|
|
|
in Visual Studio J++, you can "import com.ms.wfc.* "
Where do i find this wfc class and its methods like app and core in J# using visual studio?
please help
mail me at malluprincez@yahoo.com
---ashwathi
|
|
|
|
|
I am implementing the ISerializable interface to serialize objects using the BinaryFormatter. The BinaryFormatter provides specific type information when serializing objects. I would like to use the type information, more specifically the version to handle objects which change over time. In the serialization process I can see that the type information is properly being saved. However, in the deserialization process, I cannot see the type information of the saved object. There is an property of the SerializationInfo object passed into the deserialization constructor called AssemblyName. I believe this should be the Assembly data of the previously saved object, but it appears to be the Assembly data of the current object. Is this correct? If so, how do I know the version of a previously saved object?
LindaK
|
|
|
|
|
hi all,
i'm using dynamic assembly at runtime, but i want to change it at the runtime by overwrite on it. System message: "Can not copy (file.dll): It is being used by an other person or program. Close any programs that might be using the file and try again." could you tell me how to change or replace assembly at runtime
thanks
cuong
|
|
|
|
|
cuong_nguyentuan wrote:
i'm using dynamic assembly at runtime, but i want to change it at the runtime by overwrite on it.
Then why save it to disk? Why not keep in memory? Anyways to get the type unloaded you will have to unload the appdomain. My PluginManager article mite be of use. http://www.codeproject.com/useritems/PluginManager.asp[^]
Cheers
I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
|
|
|
|
|
Hiya I am looking to see if I have SourceSafe 6.0 ( that ships with .net - Enterprise developer - which is what I have ) installed...
Does anyone know where abouts it is in the MICROSOFT VISUAL STUDIO.NET directory.
Also where can I get info on using it.
Thanks,
grahamoj.
|
|
|
|
|
grahamoj wrote:
MICROSOFT VISUAL STUDIO.NET directory.
Not there, look under program files, it has its own directory and a few menu items if I rememebr correctly, personally I use CVS. Also it doesnt get installed by default.
I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
|
|
|
|
|
Hi,
I want to make an extensive API library that wraps as many API calls as possible but I don't know how I would implement them.
There are a few possibilities:
- By DLL (User32, Kernel32, etc.)
- By Category (Graphics, Files, XPThemes, etc.)
- Alphabeticly (nooooo!!!!)
- ???
I would like to have some suggestions on how to do it.
The programming itself is no problem, only the maner of implementing them.
btw: If you have classes/code to share please I could use them as it will speed up the process a little bit.
Thanks in advance.
Greets,
Poolbeer
Speak Out! Use the Source, Luke!
(Dr. GUI .NET #5)
|
|
|
|
|
Have a look at the beta implementation of Win32 security by MS on GotDotNet. Lotsa interop. But it will give you an idea.
On the other hand, you want to make you classes as OO as possible. Have a look at my nBASS library where I have to deal with static and "instance" objects. I say "instance" as the interop is on a library written in C hence no OO structure at all and only give me a pointer to work with. It took several (4/5) drafts to get the final OO model in place. Even with to soon to be released version, I have incorporated designer support, which is quite a task when your object is a singleton.
You can find the latest source on SourceForge: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/nbass/nBASS/[^]
It might be of some interest. All I can say is plan, plan, plan, then action.
I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
|
|
|
|
|
Thanks,
I will have a VERY good look on your library. I think I'll just start small and incorporate a few APIs at a time and change as much as possible to get that OO thingy in place.
Greets,
Poolbeer
Speak Out! Use the Source, Luke!
(Dr. GUI .NET #5)
|
|
|
|