|
Hello C#-Community!
I´ve a problem with a ImageStream from a Resource file.
My programming partner (not available anymore) used some nice icons (I hope they are icons!), but he embedded them in a resource-file.
It´s no problem to get these Images via:
<br />
private System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(TestRessource));<br />
private System.Windows.Forms.ImageList imlIcons;<br />
<br />
<br />
this.imlIcons.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imlIcons.ImageStream")));<br />
<br />
imlIcons.Images[0].Save("test.ico", ImageFormat.Icon);<br />
<br />
But the Save-Method did not return the expected result. The resulting .ico-file is only a Hex-File.
To understand what he is doing with the stream - here is a code snippet from the resource file:
<data name="imlIcons.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value> Private</value>
</data>
<data name="imlIcons.Location" type="System.Drawing.Point, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</data>
<data name="imlIcons.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
<value>
AAEAAAD/////AQAAAAAAAAAMAgAAAFpTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0xLjAuNTAw
MC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZT
....
.....
....
</value>
</data>
Can anybody help me to save each image in a seperate .ico-files, so that I can use these icons in other applications?
Or how can I find out in which format these images are? And then how I can convert them into icons?
Please, I need help...
Norman-Timo
|
|
|
|
|
Does really no one knows something about my problem?
*PushThreadForward*
Ciao
Norman-Timo
|
|
|
|
|
I would like to create an application that does not appear in the Windows Task manager and system Try or any other means that might detect its existance
|
|
|
|
|
I think that´s not possible!
Because in the Task-Manager are all processes shown, equal which application is behind it.
You´re only solution can be that you hide your application behind a strange name or another name.
(Are you programming a virus?)
Why should this application not be listed in Task-Manager?
Perhaps you can run your application with a different user so that your "normal" user can´t stop your application, but to do this in stealth mode, I think that´s not possible...
Ciao
Norman-Timo
|
|
|
|
|
|
I once had to do this when I was at DaimlerChrysler. We had to disalbe running Windows Explorer completely. Policies covered every way we could come up with to stop it from running, except one. No matter what, you could still launch it using the WindowsKey-E. Even if EXPLORER.EXE was in the list of restricted applications!
The solution was to write a little keyboard hook .EXE that watched for the keyboard messages that signals the WindowsKey Up/Down and eat them. Unfortunately, it also showed up in the Task List. The trick, rename the .EXE to svchost.exe...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Additional Question:
How can somebody use Windows (Operating System) and start in this Environment an application without Windows has been signalized from it?
Windows uses the Task-List Manager as a CoreComponent. Starting an application under Windows without using the Task-Manager means that the application has to be started outside from Windows.
But Windows is a unique working Operating System.
You have the decision:
Starting Windows and your application -> Application appears in Task-List.
Starting Application without Windows (perhaps directly from Bios?) -> Assembly Hacking (I wish you luck )
So maybe your question is clearer now...
Ciao
Norman-Timo
|
|
|
|
|
Hi, id like to crate Cursor from image or bitmap made in program (not from file). And is there a way how to draw on existing cursor ? Thanks.
|
|
|
|
|
Can anyone show me how to enable XP-Style selection highlight for a ListView control? Thanks in advance.
Radgar
"Imagination is more important than knowledge." - Albert Einstein
|
|
|
|
|
I assume you mean how Windows explorer lets you drag a rectangle around the files/folders you're selecting? If that's what you mean, I'm not sure this functionality is available. If it is, it would be available in UxTheme.dll (search codeproject for this). In .NET 2.0, there is a wrapper for UxTheme in the form of System.Windows.Forms.VisualStyles.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Hallelujah! It's Ken Jennings!
Judah Himango
|
|
|
|
|
I am experiencing problem regarding calling a "PostThreadMessage" function from outside the thread function. A code is attched below... Please go through it and guide me as to how to go about correcting it...
/*
The PRODUCER and OTHER threads post messages to the
CONSUMER thread. All the threads wait on the
"consumerReady" event to be set by the main thread.
*/
#include <windows.h>
#include <iostream.h>
#include <stdio.h>
typedef struct temp
{
int msid;
char *msg;
}box;
// Thread IDs. Define these globally so the threads can refer to each other.
DWORD producerID, consumerID, otherID;
void get_msg(DWORD quid,box *obj);
void post_msg(DWORD quid,box *obj);
// An event
HANDLE consumerReady;
// The producer thread.
DWORD WINAPI produce(LPVOID)
{
// Do not start producing until all threads are ready.
WaitForSingleObject(consumerReady, INFINITE);
int count = 0;
while(count < 2)
{
box *ptr;
ptr=(box *)malloc(sizeof(box));
ptr->msg = (char *)malloc(10);
strcpy(ptr->msg,"hello\0");
ptr->msid = 12;
post_msg(consumerID,ptr);
// PostThreadMessage(consumerID, WM_USER, (WPARAM)ptr, 0); // works fine if this
// line is used instead
// of above line
Sleep(1000);
printf("\nposted 12");
count++;
}
return 0;
}
// The consumer thread.
DWORD WINAPI consume(LPVOID)
{
// Do not start producing until all threads are ready.
WaitForSingleObject(consumerReady, INFINITE);
Sleep(0);
int count = 0;
while (true)
{
box *ptr;
ptr=(box *)malloc(sizeof(box));
ptr->msg = (char *)malloc(10);
get_msg(consumerID,ptr);
count++;
printf("count %d",count);
}
return 0;
}
DWORD WINAPI other(LPVOID)
{
// Do not start producing until all threads are ready.
WaitForSingleObject(consumerReady, INFINITE);
int count = 0;
// Send simple integers. Use WM_USER messages with the integer values
// in the wParam field.
while(count < 2)
{
box *ptr;
ptr=(box *)malloc(sizeof(box));
ptr->msg = (char *)malloc(10);
strcpy(ptr->msg,"other\0");
ptr->msid = 11;
post_msg(consumerID,ptr);
// PostThreadMessage(consumerID, WM_USER, (WPARAM)ptr, 0); // works fine if this
// line is used instead
// of above line
Sleep(1000);
printf("\nposted 11");
count++;
}
return 0;
}
// main() runs the simulation.
int main()
{
// Create an event which is initially unsignaled
consumerReady = CreateEvent(0, TRUE, FALSE, 0);
// Create the threads and start them immediately.
HANDLE consumerHandle = CreateThread(0, 0, consume, 0, 0, &consumerID);
HANDLE producerHandle = CreateThread(0, 0, produce, 0, 0, &producerID);
HANDLE otherHandle = CreateThread(0, 0, other, 0, 0, &otherID);
//Set the event now that all threads are ready
SetEvent(consumerReady);
//Keep the main thread alive
WaitForSingleObject(producerHandle, INFINITE);
WaitForSingleObject(consumerHandle, INFINITE);
return 0;
}
void post_msg(DWORD quid,box *obj)
{
PostThreadMessage(quid, WM_USER, (WPARAM)obj, 0);
int err = GetLastError();
printf("\n obj_post->msgid %d ",obj->msid);
printf("\n err_post = %d ",err);
}
void get_msg(DWORD quid,box *obj)
{
MSG lmsg;
GetMessage(&lmsg, 0, 0, 0);
obj = (box*)(lmsg.wParam);
int err = GetLastError();
printf("\n obj_get->msgid %d ",obj->msid);
printf("\n obj_get->msg %c ",*(obj->msg));
printf("\n err_get = %d ",err);
}
///////////////////////////////////////////////////////////////////////
The output is given below:
obj_post->msgid 12
err_post = 1444
obj_post->msgid 11
err_post = 1444
posted 12
obj_get->msgid 12
obj_get->msg h
err_get = 0 count 1
posted 11
obj_get->msgid 11
obj_get->msg o
err_get = 0 count 2
obj_post->msgid 11
err_post = 1444
obj_post->msgid 12
err_post = 1444
posted 11
posted 12
////////////////////////////////////////////////////////////
As can be seen , posting the messages results in a error id of 1444(INVALID THREAD IDENTIFIER) which is puzzling cos all the threads are already created....
Any help would be appreciated in this regard...
|
|
|
|
|
|
ok, I have a simple regular expression:
<br />
Regex to_find = new Regex(textBox2.Text, System.Text.RegularExpressions.RegexOptions.None);<br />
textBox3.Text = to_find.Matches(richTextBox1.Text, 0).Count.ToString();<br />
obviously, it just sends the count of the resulting matches to textBox3. this is good to test regular epxressions, but it doesn't provide any way I can see to format the results (besides the replace option). like for instance, I would like to atleast select the results one at a time (select, not highlight), without using the "find" thing for a richTextBox.find(...). even more though, I would prefer to actually be able to highlight the results in blue or green or something of that sort, rather than just selecting them. where do I find these options for regular expressions? sry I don't know all the big terms for classes or what not.
thanks for the help,
Stephen P.
|
|
|
|
|
|
what is the easiest way to get the current system time?
|
|
|
|
|
DateTime.Now.ToLongTimeString() or something like that.
I'm too damn lazy to look it up.
|
|
|
|
|
You beat me by two minutes!!
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
|
I have a shortcut on the desktop, and I have a path to it, but if I try to use it, a new folder is created on the desktop. How do I take the path to a shortcut and get the path to the actual folder ?
Thanks
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
I've found a way of doing it, but it involves a COM interface. If there's a non-COM way, I'd love to hear about it....
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
What do you mean by "but if I try to use it, a new folder is created on the desktop"? Are you trying to access a folder shortcut? Can you explain it a little more?
It seems you've solved the problem via COM but here is another solution via Com Interop to Access the Windows Scripting Object. Maybe useful for a clear solution:
http://www.knowdotnet.com/articles/createshortcutondesktop.html[^]
|
|
|
|
|
(plz i need help, to make apper the bmp image as a pixles by c#
|
|
|
|
|
Wow - you do need help.
Image.FromFile
DrawImage
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
MSDN as usual sucks on documenting this, and most threads contain only partial code. I'm trying to create a windows service that allows anyone to call its "bool HelloWorld(string sSayCheese)" method via remoting.
The consumer of this method will be an asp.net page, but for now can be anything including a console app.
I have created many Windows services, so this is not the problem. The service is running fine, but I can't get it to allow others to call its public methods remotely.
Any help would be greatly appreciated for myself and the other devs in the office.
Thanks!
|
|
|
|
|
I usually put all my objects offering remote calls in a class library project. Then I can debug them by hosting them from a console application. As soon as they are debugged, I put the remoting configuration code in the service OnStart and the system.runtime.remoting section of the config file in the service config file. Either way, the startup code is the same whether it is in the Service OnStart or in a console app main().
The hardest part of your problem is consuming the remote objects from a web app; you must put the client configuration code in the Global.asax code behind file in the Application_Start method.
There are many people here who can answer your questions if you can make them specific enough. Are you having trouble with the remoting part, or is it that you don't know about Global.asax Application_Start? Give us some info and we can help.
|
|
|
|
|