|
Hello,
Just a thought
How can I take the icon from one exe and put it on my exe
programaticly of course
Or should I say can I?
I mean I know about the FindResource function but you have to give it the name of the icon
as the second parameter the name of that particular resource.
So how can I get an exe's icon and how can I then load an icon into my exe and set it as my
exes ico.
icons icons icons
|
|
|
|
|
Can you use ExtractIcon() ?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hello,
I am gleening some code that I found that uses OLE for Drag&Drop across multiple CListCtrls. The main problem is that I am very new to Visual C++ and need some help with LVITEM structures.
In my .h file I have
typedef struct {
LVITEM lvi;
char szLabel[256];
CString sFrom;
CString smsg_num;
} ListInfo;
And am trying to get multiple column data from a CListCtrl to drag&drop.
In my .cpp file I have:
...
void CDDListCtrl::OnBegindrag(NMHDR* pNMHDR, LRESULT* pResult)
...
// Create global memory for sharing dragdrop data, we allocate
// space for 2 int and nItem ListInfo structures
HGLOBAL hgData = GlobalAlloc(GPTR,m_nItem*sizeof(ListInfo)+2*sizeof(int));
ASSERT(hgData!=NULL);
char* p = (char*) GlobalLock(hgData);
ASSERT(p!=NULL);
// Place control type in first 2 bytes
*(int *) (p) = CT_LIST;
// Place number of list items in next 2 bytes
*(int *) (p+sizeof(int)) = m_nItem;
// Then the nItem ListInfo structures will start at:
ListInfo* lpData = (ListInfo*) (p + 2*sizeof(int));
CString DebugStr;
// Here is where we read all selected items into array. - Murrah
int jItem = -1;
int i = 0;
while ((jItem = GetNextItem(jItem,LVNI_ALL | LVNI_SELECTED)) > -1)
{
ASSERT(i>=0 && i <m_nItem);
ZeroMemory(&lpData[i], sizeof(ListInfo));
lpData[i].lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM | LVIF_STATE;
lpData[i].lvi.stateMask = LVIS_DROPHILITED | LVIS_FOCUSED | LVIS_SELECTED;
lpData[i].lvi.pszText = (char*) &(lpData[i].szLabel);
lpData[i].lvi.iItem = jItem;
lpData[i].lvi.cchTextMax = 255;
// GetItemText works here, now to figure out how to get it into lpData[i];
//DebugStr.Format(_T("%s"),GetItemText(jItem, 2));
//AfxMessageBox(DebugStr);
// pDragList->GetItem (lvi.plvi);
// lvi.sFrom = pDragList->GetItemText(lvi.plvi->iItem, 1);
// lvi.smsg_num = pDragList->GetItemText(lvi.plvi->iItem, 2);
BOOL bSuccess = GetItem(&(lpData[i].lvi));
ASSERT(bSuccess);
// lpData[i].sFrom = GetItemText(jItem, 1);
m_pSaveIndItem[i] = jItem;
i++;
}
...
I gleened this code from another application that I found (except I added the two CStrings in the ListInfo structure), and it works fine for a single column CListCtrl, but I can't figure out how to get my other column data into lpData[i].
GetItemText(jItem, 1) and GetItemText(jItem, 2) both return the correct data for the subitems, but I just can't figure out how to get it into lpData[i].
Also, once I do get the data into lpData[i], how do I get it back out when I finalize the drop?
Thanks,
Murrah Boswell
|
|
|
|
|
Can someone please tell me how can I find out the number to which my computer is connected when using a dial-up connection, without using phone-books. I want to monitor a dial-up connection that I haven't initialized in my program so I have to find out its handle first
Thanks
|
|
|
|
|
nemoo wrote:
...without using phone-books.
How else would you do this without looking at the RAS phone book? Once the connection has been established, the number connected to is no longer relevant, thus the TCP/IP layer does not know, or need to know, about it. Call RasEnumConnections() to get the active connections (presumably you have only one), then call RasGetEntryProperties() to get the phone number used.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I've used CreateProcess to start .exe from inside apps before, and they've worked fine. However, I created a service application which starts at boot-up. It cannot seem to use the exact same functions I've used before. Why is this?? Thank you.
|
|
|
|
|
Hard to know for sure but it could be related to the account the service is running in verses the how the process (application) you are starting is installed. For example, if the service is running under the local system account and the application is trying to get values from the HKEY_CURRENT_USER registry keys that is going to break.
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
The application that the service is trying to start is one of my own creation. It's a simple console app which does not use any reg keys. Just as a test I called CreateProcess with the notepad.exe inside the service app. Nothing...
|
|
|
|
|
When you say 'boot' do you mean before any user is logged in, while the blue/black screen is up? You might have failure because there is no desktop yet?
I am not so sure that you can launch an 'interactive' application at boot time.
Do you get any meaningul error value from GetLastError?
Your service might need to use CreateProcessAsUser to really get this to work right, if it is going to work at all.
|
|
|
|
|
It may be that the process *is* being created, but you can't see it. A service has it's own desktop, so notepad will be running on that (invisible) desktop. I suggest you use Task Manager to see if the process is running (it will show up in process list in Task Manager even when running on a different desktop).
|
|
|
|
|
The program will probably start, but the service does not run in the same desktop context as you do, so you need to allow it to show stuff on your desktop...
Go to the services settings and check "allow service to interact with desktop"
- Anders
Money talks, but all mine ever says is "Goodbye!"
ShotKeeper, my Photo Album / Organizer Application[^]
My Photos[^]
New developersite: RealDevs.Net
|
|
|
|
|
suppose that u a writting a software to give grading to three different types of student certificate,diplom and degree students,all students will be required to sit for exams which wil be graded as follows:
1-39: F
40-59: D
59-69: C
70-79: B
80-100: A
In addition to that, the Diploma students will be required to attend the 'lab tes' session that awards them 'P'(PASS), 'F'(Fail)or 'X'(ABSENT). The Degree students, on the other hand, need to undergo an 'Industrial Training' that requires the employers to give 'G'(GOOD), 'A'(AVERAGE) or 'P'(POOR).
This program is expedted to be used by the Exam Department that eners student Names and their IC numbers besides the above details. This program should also be able to highlight the highest mark, lowest mark and failure rates for each program. Once the data have been recorded, they shall be stored as a data file for future reference.
Provide a solution to the above requirments using classes, an Object Oriented approach and C++ language.
|
|
|
|
|
Here we go again! Another homework
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fuity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
I charge $150/hour for a minimum of 4 hours.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
>> I charge $150/hour for a minimum of 4 hours.
Will you wear a dress and take it doggy style?
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
|
?? Sorry my glyph translator is in for repair.
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
> Re: how to write this program?
I think the best way would be to use a computer and some software.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I think you're supposed to ask that in the Lounge, where the better programmers hang out *mad laughter*
|
|
|
|
|
Artificial intelligence is no match for natural
stupidity.
|
|
|
|
|
< laughing tears />
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
Hello,
i'm developing a chat program. There's a vector of pointers to Dialogs. When i open a chat window, a NEW is called to that dialog, then i call create and showwindow to show the dialog. The windows are deleted when i close the program.
I'm not having trouble with that.
When i close a window, i send a message to the remote client to close the window. The remote client receives this message in a function from the dialog, and there i want to close the dialog (not the remote one):
CVentanaPizarra::OnClose();
CDialog::EndDialog(0);
In the OnClose I have the following:
void CVentanaPizarra::OnClose()
{
CDialog::OnClose();
}
If i don't use EndDialog, the dialog doesn't close. If i use EndDialog, when i want to open the dialog again, the program crashes.
i don't want to delete the memory, just hide the dialog, or close it in some kind of way. i know it works locally, as when i close with the X, then i can open it again, but not when i receive the message.
I searched in msdn, and it says EndDialog is or modal dialogs. So i tried DestroyWindow. I also tried ShowWindow(SW_HIDE) but it doen't work as well.
I'd really appreciate any kind of help you could give me.
Thanks in advance!
|
|
|
|
|
If it is a modeless window - as I understand - then I should go for ShowWindow( SW_HIDE ) . The drawbacks are that you might need to reinitialize controls when showing it again.
Note that first, you create the window with Create . Then you use ShowWindow( SW_SHOW / SW_HIDE ) for all showing and hiding - you don't call Create again.
|
|
|
|
|
ShowWindow will work fine, but keep in mind, the more windows you create (and eventually hide again), the more memory your app will comsume.
A better way would be to destroy the windows if you don't need them again and call delete this; in the PostNcDestroy -function of your dialogs.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
hiya
i'm trying to import ~1000 records into a database per transaction (1 transaction per second). I'm thinking that use of a DataSet / DataAdaptor will be a good idea, i.e. create the local DataSet and then commit this to the database. But due to the size of the database, around 1gb, i don't want to do make a local copy of the database every time i want to do an insert (i'm not changing the existing data). Is it possible to make an empty DataSet of the target database table, fill this with inserts, then commit this to database WITHOUT deleting the existing data?
Thanks!
J
|
|
|
|