|
Hi all
SO I read this:
Content - The file is not compiled, but is included in the Content output group. For example, this setting is the default value for an .htm or other kind of Web file.
So now I have a assemblyname.dll.config file set as content, but its not outputted to the "output" directory.
Any suggestions?
MyDUMeter: a .NET DUMeter clone "Thats like saying "hahahaha he doesnt know the difference between a cyberneticradioactivenuclothermolopticdimswitch and a biocontainingspherogramotron", but with words you have really never heard of."
|
|
|
|
|
Hello,
As you might know CodeGuru is an excellent web site were tones of controls and software in general is posted for free.
For historical reasons the big majority of contributions are witten for MFC (VC 6.0), ATL, and alikes. If you surf it you'll colud find very valuable pieces of software.
Most of them come in files .h and .cpp that integrate smoothly whith an MFC app.
I would like to ask a question: Somebody knows a way or has tried to reuse this software from NET and C# using interop?
Thanks,
Josep L Colom
|
|
|
|
|
Basically most content from Cg and Cp don't expose (export) anything. They are classes to be added to your MFC-based VC++ projects. So that's a bit weird of a question.
With C#, I can't really figure out what you could do out of most "MFC controls" code in Cg and Cp, since interop only allows you to import dll functions, not classes. (I don't know if this has been improved with VS.NET 2K3).
With MC++, things get somewhat better. Watch out this article[^] (registration required).
That said, MFC has its use in his context ("old" C++), and Windows Forms is simply the de facto .NET UI framework to use.
|
|
|
|
|
One way to reuse I taught was (if possible, but I don't know how) to convert those .h/.cpp clas(ses) to an ActiveX control. May be creating a new MFC ActiveX DLL project, and then, through interop to access this ActiveX (COM object).
But may be I'm saying a nonsense thing..
|
|
|
|
|
Josep L Colom wrote:
One way to reuse I taught was (if possible, but I don't know how) to convert those .h/.cpp clas(ses) to an ActiveX control. May be creating a new MFC ActiveX DLL project, and then, through interop to access this ActiveX (COM object).
Although that's true in theory, since ActiveX type libraries can be imported in the .NET world, I believe you should engage this way only as last option. Reasons are :
- the marshaler (type library importer) has a few bugs, and as a consequence it's likely you have issues when calling exposed interfaces.
- you have to build the ActiveX first, which means you have to provide implementation for IOleClientSite and some other containers as well. Got my point ? You'll end drop dead before you get a simple MFC owner drawn derived control, working fine in the .NET world.
|
|
|
|
|
I though how it was really cool how I was able to just slap togeather a regular c# program in vs and just build it into an .aspx webpage with iis...
but all the sudden when ever I build my page and the browser comes up I can't see the forms or anything on my pages...
APS.NET is really cool and it's even cooler that I can make pages in C#...
What is wrong can somebody help a kid out?
/\ |_ E X E GG
|
|
|
|
|
There are many limitations for hosting form controls in IE. Odds are, you need to modify the programs permissions. Just run mscorcfg.msc and configure the assembly.
Hope it helps, else give more info.
MyDUMeter: a .NET DUMeter clone "Thats like saying "hahahaha he doesnt know the difference between a cyberneticradioactivenuclothermolopticdimswitch and a biocontainingspherogramotron", but with words you have really never heard of."
|
|
|
|
|
What do you mean
run mscorcfg.msc and configure the assembly.
I have no clue what your talking about.... try explaining it to me in 6th graders terms...
THANKS.
/\ |_ E X E GG
|
|
|
|
|
If you installed IIS after VS.NET you might have a problem with the aspnet_isapi.dll not being registered. Try running "regsv32 aspnet_isapi.dll" in the command window.
|
|
|
|
|
can you elaborate more I have no clue what your talking about.,....
/\ |_ E X E GG
|
|
|
|
|
I can try...
When you install IIS after you install VisualStudio, there might be a problem with the "connection" between the two. I had a problem with debugging asp pages, and IE did not display components, only HTML. To resolve this problem you can reinstall VS, but another way is to register the dll i mentioned. The command prompt is found under the start menu. Does that answer it? If not, specify what you dont understand.
|
|
|
|
|
im looking for a way to encrypt a file name..and still keep it a valid file name...and then beable to decrypt it just from the file name. I tryed using a RC2 encryption...and then coverting it to a base64 string but i get a error sometimes saying "could not find part of path name such and such".. is there another way to do this and still beable to decrypted the file name and return it to the original ?
Thanks Alot
Jesse M
The Code Project Is Your Friend...
|
|
|
|
|
I don't quite follow what you mean Jesse..
If you want to identify the file as being encrypted, you could just add your own unique extension on the end:
document.doc -> document.doc.enc -> document.doc
Then remove it when decrypting using the Path class to strip off your added extansion. This way there's no need to store any filename info in the encrypted data at all.
However, if you want to store the original filename in the encrypted stream, replacing with something totally unrelated like this:
document.doc -> encrypted.file -> document.doc
Then it's going to be a little trickier. What you need to do here is use the Path class the get just the filename (not the whole path) of the source file, then store the length of the filename string in the encryption stream, followed by the string name itself as bytes. When decrypting, you will need to read your filename length first, then read that amount of bytes to re-create the filename, then read & decrypt the actual file data.
|
|
|
|
|
thanks furty i found something that fixed the problem for me using RC2 and memory streams... i used that path class...and sent just the name to the seperate "class" where the name was encrypted and then returned.... apon decryption i send the "encrypted" name back...and it decrypted that string using the same password... you were write on the last part.. i just had no idea how to do it because when i did it...it would encrypt the string and return a name that was too long...for a valid windows file name. the following code encrypted the string and fixed the problem...
thanks... Jesse M
please keep in mind this encryption method i know isnt the correct way to do it...but its just for a file name.. so i did it the easyiest way =)..
public string FilterInName(string pToEncrypt){<br />
try{<br />
if(pToEncrypt.Length<=3){<br />
<br />
return pToEncrypt;<br />
}<br />
string sKey = "alPhatab";<br />
DESCryptoServiceProvider des = new DESCryptoServiceProvider();<br />
byte[] inputByteArray = Encoding.Default.GetBytes(pToEncrypt);<br />
des.Key = ASCIIEncoding.ASCII.GetBytes(sKey);<br />
des.IV = ASCIIEncoding.ASCII.GetBytes(sKey);<br />
MemoryStream ms = new MemoryStream();<br />
CryptoStream cs = new CryptoStream(ms, des.CreateEncryptor(),<br />
CryptoStreamMode.Write);<br />
cs.Write(inputByteArray, 0, inputByteArray.Length);<br />
cs.FlushFinalBlock();<br />
<br />
StringBuilder ret = new StringBuilder();<br />
foreach(byte b in ms.ToArray()){<br />
ret.AppendFormat("{0:X2}", b);<br />
}<br />
return ret.ToString();<br />
}catch(Exception ){return pToEncrypt;}
The Code Project Is Your Friend...
|
|
|
|
|
It seems that it's not possible, to fit a Windows Form in a Control (such as a Panel, for instance). I can think of a few good reasons why that's true, but I'm just doublechecking. It'd be pretty handy for me if I could fit a Form in a Control, so I don't have to replicate many things; MDI Forms in a Control would be even nicer.
|
|
|
|
|
Here's very quick fix (one I remember Paul Watson enjoyed):
Let your form inherited from UserControl instead (mite need 1 or 2 changes). Then just drop that in a form with filled docking.
MyDUMeter: a .NET DUMeter clone "Thats like saying "hahahaha he doesnt know the difference between a cyberneticradioactivenuclothermolopticdimswitch and a biocontainingspherogramotron", but with words you have really never heard of."
|
|
|
|
|
There are at least two ways to go about it, the first is the best way if you can modify the design which you have given above.
The second is what you'll have to do if you have no choice but to leave it as a Form. You won't get any design time support for it either, but something is better than nothing
Since the Form class inherits ultimately from the Control class it is possible for a Form to be added as a child control.
To do this, first create an instance of the Form (MyForm mf = new MyForm() ). Now set any properties you want on it, especially the Location , and Size properties. Now set the TopLevel property of the form to false (mf.TopLevel = false ). You may or may not see this property in the IntelliSense pop-up, don't worry it is there
Now add the form to the Controls collection, Controls.Add( mf ); . Lastly you need to make the form visible, mf.Visible = true .
All together now:
MyForm mf = new MyForm();
mf.Location = new Point( 8, 8 );
mf.Size = new Size( 150, 300 );
Controls.Add( mf );
mf.Visible = true;
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
Just some dry, semi sober humor for you folks
MyDUMeter: a .NET DUMeter clone "Thats like saying "hahahaha he doesnt know the difference between a cyberneticradioactivenuclothermolopticdimswitch and a biocontainingspherogramotron", but with words you have really never heard of."
|
|
|
|
|
|
Go unsafe
Also post some code and give an explanation of the unmanged function you are trying to use. Your bets are string and StringBuilder, depending on the situation.
MyDUMeter: a .NET DUMeter clone "Thats like saying "hahahaha he doesnt know the difference between a cyberneticradioactivenuclothermolopticdimswitch and a biocontainingspherogramotron", but with words you have really never heard of."
|
|
|
|
|
see title
I see dumb people
|
|
|
|
|
See previous post
MyDUMeter: a .NET DUMeter clone "Thats like saying "hahahaha he doesnt know the difference between a cyberneticradioactivenuclothermolopticdimswitch and a biocontainingspherogramotron", but with words you have really never heard of."
|
|
|
|
|
You probably don't need to since the marshaler does this as part of his job.
In case you are using .NET 1.0 and encounter marshaling limitations (there are a few bugs), you may do the marshaler's job by creating a block yourself : IntPtr pCharBlock = Marshal.AllocHGlobal(nSize); . More info here[^].
|
|
|
|
|
|
I have a varible that is declared in the main application form as public. How can I get at this varible from another form. I have tried accessing the forms varible via Form1.varible and this.ParentForm.varible and so forth. All to no avail and I need to have access to this varible from anywhere in the program. Any suggesttion would be greatly appreciated.
|
|
|
|