|
My fault, i forgot about that and it was the first thing to come to my mind tLbimp the IDL. I look at the sdk and im creating a wrapper manually since the IDL didnt come with a Dll or tlb.
The code is for Microsoft Media Center. Its the Media State Aggregation Service, it lets user set up an PC case LCD display to show info about a current playing media, or an software to display info whatever i code it for.
I dont know much about C++, in class we never got this far, but can i just compile the IDL with a c++ compiler ( i need to find one)? if not i just continue creating a wrapper manually im almost done.
modified 16-May-21 21:01pm.
|
|
|
|
|
Hi Guys,
I just want to ask for suggestion regarding webcofig file. I declare my connection string in webconfig file so that all aspx can use the same connection under one project. (dynamic) rather than using the SqlConnection control from toolbox.
WEBCONFIG:
<add key="UserConnection" value="Data Source=localhost;server=os01;Initial Catalog=personnel ;User Id=person;password='per123'">
Question:
I'm using two server one for development and one for production. When I develop or maintain system I used of course the development which is named "os01".Is there anyway possible under webconfig file that when I transfer my project on our production machine which is named "os02" my webconfig file connection string will will detect that he is already using the production machine, from "os01"
it will become "os02" I don't have to change my webcofig file "CONNECTION STRING" everytime I change a server name.
I appreciate whatever ideas you will give, you will not only enlighten me but also others who will read this thread.
|
|
|
|
|
Is that so hard before you compile your setup project just click some keys and change 1 to 2?
Mazy
"I think that only daring speculation can lead us further and not accumulation of facts." - Albert Einstein
|
|
|
|
|
Hi,
Actually it's only a blink of an eye. I'm just asking for suggestion to be more dynamic. I'm maintaining and dveloping multiple systems at the same time specially if there are urgent matters.
If you're not multi tasking then your answer is acceptable.
cheers
/dabsukol
|
|
|
|
|
Ok , one way which come to my mind is set two tag for it , when you are at debug time read it and when you use relaese setting for your project(which means its user machine) for your project read other tag. If its not clear just let me know and I explain more with details.
Mazy
"I think that only daring speculation can lead us further and not accumulation of facts." - Albert Einstein
|
|
|
|
|
If you plan on deploying this solution to machines using an installation project like a Windows Installer package (which VS.NET includes a basic Windows Installer project for doing just that), you could create your own Installer class that reads-in the Web.config file and changes the values in it based on the target machine, which it then saves back out to disk.
One more idea is to modify the Application_Start handler in the Global.asax file (or its code-behind file) that gets the machine name and conditionally updates the Web.config file, which will cause the web application to restart and your settings should be correct.
Otherwise, Mazdak's right. You'll just have to manage your project in a different manner using different build configurations or making the change after you move it.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Dear friends,
Can I show the dialog with the effect like calling .ShowDialog(this)?
I want to call .Show() only, since .Show() won't cause the program wait in the instruction.
What I wnat to do is, I want to show one dialog in the top(locking UI a little time, like calling ShowDialog), then do the process in next instruction.
<br />
DialogDD wd = new DialogDD();<br />
wd.TopMost = true; <br />
wd.Show();
<br />
outThread = new Thread(new ThreadStart( this.ThreadProcess ));<br />
outThread.IsBackground = true;<br />
outThread.Start(); <br />
<br />
<br />
wd.Close();<br />
could someone give me some ideas? Thanks
|
|
|
|
|
This may not be the purest way to do what you ask, but it may accomplish what you want to do:
Add a timer to your DialogDD form.
In the Timer_Click event, do a Timer.Stop() and return.
On the other hand, if you are doing a progress bar kind of thing, then you may want to look at the DynamicSplashScreen project here on code project.
For example look here[^]
______________________________
The Tao gave birth to machine language. Machine language gave birth to the assembler.
The assembler gave birth to the compiler. Now there are ten thousand languages.
Each language has its purpose, however humble. Each language expresses the Yin and Yang of software. Each language has its place within the Tao.
But do not program in COBOL if you can avoid it.
|
|
|
|
|
I think what you're looking for is an owned window. Before calling Show , set the form's Owner property to whatever form should own the window (most likely the main application form). This results in that form always being on top of the owner form but allows the thread to continue. A good example of how this would look is a typical Find window, like in Internet Explorer or any of the Office programs that lets you keep the Find window on top of the other form but let you interact with the main application form. This also ensures that when the owner form is closed, the owned dialog is too.
Also, a form can own multiple forms, but a form can have only one owner.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
This results in that form always being on top of the owner form but allows the thread to continue.
yes, that's works, I have tried to set it's owner :
wd.Owner = this; // or this.MdiParent;
because this Form is an MDI child Form..
what I wnat to do is to make this dialog shows on the top of application, and hope it cannot be minimized until it has been closed.
if I only set its owner, it becomes able to minimize, how can I improve this ??
Thanks
|
|
|
|
|
If it's an MDI child, it can't really show on top of the MDI parent (at least, not using anything in the .NET FCL). Also, while you can disable the minimize and maximize boxes on the MDI child itself, if the MDI child is maximized, the minimize and maximize buttons are made available right below the MDI parent's like a common MDI application. There has been discussion on this before, but I believe without any resolution.
If you want the form to appear above the main application, then it shouldn't be an MDI child and should instead just be a regular form for which you set its Owner property.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello,
I've been working on an MDI .NET project and am having a problem with my MDI children. There are 6 children that have no toolbars, some are resizeable. I want the user to be able to click anywhere on the child forms (except for controls) and drag that child around anywhere inside the MDI parent.
My problem is that I can't seem to get them to drag properly or look attractive while dragging. The mouse cursor will become offset during the drag and move ahead of the form, or there are bad trailing effects following the forms that won't go away until the user releases the mouse.
I've been unable to find any information that would help with effecient and attractive full-form dragging.
Basically I want to simulate dragging the form toolbar while clicking anywhere on the form. Any help or direction to an article/post would be very appreciated.
Cyric
|
|
|
|
|
I'm not sure how you're doing it now, but basically set a flag in the MouseDownm event handler (or better, override OnMouseDown , which also is better for the other events I'll mention - just don't forget to call base.OnEventName ). In the MouseMove handler move your form only if the flag is set. Finally, in the MouseUp handler reset the flag.
While moving the form, you have a couple of choices. You can simply set the Location property but that is what is most likely causing your lag (and related problems). There's quite a bit that happens in the implementation for setting the Location property. In the MouseDown handler, it might be better to call SuspendLayout and then call ResumeLayout in the MouseUp handler. I haven't tried this so I don't know how well this will work, and it may not even display the form while dragging.
You might instead consider P/Invoking the SetWindowPos API, which you can find more information about in the Platform SDK documentation in the MSDN Library[^]. This should result in much faster code and should eliminate that lag you're experiencing.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have a collection that inherits the NameObjectCollectionBase and also has two internal state booleans. I need to serialize this collection and include the booleans. I implemented ISerializable but I cannot find very much step-by-step info. MSDN just shows using the GetObject() method to pass on to the base serializer which provides not help to me. The few articles here never touch on doing your own data serialization.
What I would like to do is serialize not only the objects in the collection, but also these two booleans. The SetType() seems to provide a means of defining the type to serialize. But everything else is Get methods to retrieve data from the SerializationInfo but I don't see how to integrate the booleans to the output. Do I just write out via the Context??? Do I set the info in the GetObject SerializationInfo object?
Any help in how to deploy this would be greatly appreciated.
|
|
|
|
|
You just need to call the base class's implementation after you serialize your own private members (or whatever else you want):
[Serializable]
public class MyNameObjectCollection : NameObjectCollectionBase
{
private int field1;
private string field2;
public MyNameObjectCollection() : base()
{
}
protected MyNameObjectCollection(SerializationInfo info,
StreamingContext context) : base(info, context)
{
field1 = info.GetInt32("field1");
field2 = info.GetString("field2");
}
public override void GetObjectData(SerializationInfo info,
StreamingContext context)
{
base.GetObjectData(info, context);
info.AddValue("field1", field1);
info.AddValue("field2", field2);
}
}
<div style="width: 100%; font-size: 2px; margin-bottom: -10px; background-color: rgba(255, 153, 0, 1)"> </div>
Microsoft MVP, Visual C#
<a href="http://www.codeproject.com/script/articles/list_articles.asp?userid=46969">My Articles</a>
|
|
|
|
|
Hi everybody,
I'm asking for 2 things:
1-I want to know the equivelant Int value for some messages like WM_SETFOCUS , WM_ACTIVATEAPP ,..etc
From where can I get information about messages like that?
2-After catching a message sent to my application by overriding WndProc(),
Am I allowed to cancel or erase the effect of the received message? and how?
for Example: (When the user presses on Maximize button, I don'twant the window to be maximized).
thanks for Help
|
|
|
|
|
1. If you have Microsoft SDK look in the "include" directory for WinUser.h, it has ALL Windows messages defined there. If you don't have the SDK, either get it or Google for the message codes. If you have VB6 I think the API Viewer has the Windows messages as well.
2. You need to implement the IMessageFilter in some class and it's only method
bool PreFilterMessage(ref Message msg)
Check the message code in msg.Msg and return either 'true' if you want to cancel processing of this message and 'false' if you want to let it through to WndProc. If you want this filter application wide you can add this message filter like so:
MyMessageFilter mf = new MyMessageFilter();
Application.AddMessageFilter(mf);
If you want to process this on just one window, just override the WndProc method. And do not call the base.WndProc after you process a message.
|
|
|
|
|
I wonder if there is an equivalent of C# to the #define prepropcessor directive of C++. The one of C# is not very useful since you can not define macros. Can i use something else, which would perform the same functions. This will really clean my code.
|
|
|
|
|
Simple answer: no, there isn't equivalant (but you can define symbols for compiler)
Complex answer:
Some solutions:
1) Develope own preprocessor that handles macros (shouldn't been too hard to do - but will make your code uncompatible)
2) Use #if (compiler symbols) to "select implementation". For example:
public abstract class DumpableObject : IDumpableObject
{
#if DEBUG
private DumpContext m_contextDump;
private int m_iDumpLevel = DumpContext.DEFAULT_DUMP_LEVEL;
protected int DumpLevel
{
get { return m_iDumpLevel; }
set { m_iDumpLevel = value; }
}
public void DumpAll()
{
DumpContext context = new DumpContext( this, m_iDumpLevel, DumpContext.DumpDetails.ALL );
}
public void Dump( DumpContext context )
{
m_contextDump = context;
OnDump();
m_contextDump = null;
}
protected virtual void OnDump()
{
}
protected void Dump( string strName, object obj )
{
m_contextDump.Dump( strName, obj );
}
#else
protected int DumpLevel
{
get { return 0; }
set { }
}
protected void DumpAll()
{
}
public void Dump( DumpContext context )
{
}
protected virtual void OnDump()
{
}
protected void Dump( string strName, object obj )
{
}
#endif
}
(Yes I know - it doesn't implement all macro tricks - but at least some). Basicly you really should be able to do almost anything without macros (just use sub methods).
|
|
|
|
|
The problem with this method is that my code size actually Increases very rapidely. I wonder how come there is no cheap tricks. Maybe I can Use attributes for that ?
But i will probably have to create a preprocessor directive myself
|
|
|
|
|
HAHAHA_NEXT wrote:
But i will probably have to create a preprocessor directive myself
I itch for that too
I use it (#if) alot. To simulate the enviroment, eg:
#define HELLO
bool Blah(string foo)
{
#if HELLO
return true;
#elseif
return false;
#endif
}
|
|
|
|
|
Hi guys!
My question is a big one as I spent all the day to find out HOW to redraw the scroll bars of a TreeView (or any other control) without finding anything!!!
So my question is how to make the TreeView's scrollbars owner drawn ??
Thanks!
Jean Bédard
|
|
|
|
|
I am using ThreadPool class and I cannot find a way to return data from the callback procedure. Does anybody have any idea how to do that.
Thank for your time
Spiros Prantalos
Miami the place to be!!
|
|
|
|
|
That's what the state parameter is for. Since it's an object - and therefore a reference type - it can be used to pass both input and output arguments. If you want better handling of parameters and return values, use asynchronous methods instead (such as BeginWhatever and EndWhatever ). If you use the proper signature for methods in C#, the compiler can actually create asynchronous methods for your methods. See Including Asynchronous Calls[^] in the .NET Framework SDK for more information.
Also, worker threads are common associated with an object that contains the data with which the callback method operates, so if it also stores state in such properties, you can always retrieve them later when the worker thread finishes, if it finishes at all (some are designed to run continuously - it's all up to your design).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
Try this sites for ideas and information.
http://www.codeproject.com/csharp/XYNetSocket.asp?target=socket%7Cprogramming
http://www.codeproject.com/csharp/socketsincs.asp
http://www.developerfusion.com/show/3918/4/
I hope this will help you.
/dabuskol
|
|
|
|