|
Hi all,
I have this problem:
I need to make a program that, when runned for the first time, creates a shortcut icon on the desktop and a group in Start menu.
How it is possible to do this ? What are the api to call??
Thanks all for any help...
Carlo Comino
|
|
|
|
|
You want to use the method: SHGetNewLinkInfo
BOOL SHGetNewLinkInfo(
LPCTSTR pszLinkTo,
LPCTSTR pszDir,
LPTSTR pszName,
BOOL *pfMustCopy,
UINT uFlags
);
Cheers,
-Erik
|
|
|
|
|
I need to have two binary dll's in my application as resources. I then will need to be able to copy them out to the hard drive and save them.
How do i get a handle to the resource (not using MFC is best) and what should i then do with it?
I'm doing this so i can include some of the MFC dll's in an setup application that are needed to run a different app.
This would really help me,
any code/suggestions Please
|
|
|
|
|
Does anybody know how to change the height of a combo-box? The "MeasureItem" function can only change the height of the items inside the combo.
thanks,
Bruno
|
|
|
|
|
please can you explain me what are threads and what are processes and
what is the difference between the two ?
thank you a lot
|
|
|
|
|
This won't be a very in depth answer, for more information check out "Advanced Windows" by Jeffrey Richter.
A process is an instance of a running program. You start a program, it will run in a seperate "process". A process must own at least one thread to execute the code in its process.
A thread runs within a process. A process can hold many threads, but it has to have at least one. A thread is what actually executes the code in a process.
I know this is very brief, but I hope it helps a little.
Wayne
|
|
|
|
|
thanks, it helped a lot ...
so process is running program
each thread have its own registers like ax,bx,CS:IP. Right ?
Use threads the same memory - memory of process ???
can one process access threads of another process?
one more question: is it ok to create around 20 threads/process - for example each thread for each wininet download ???
|
|
|
|
|
A good source would be Joseph M. Newcomer's articles on this site, under General Category Threads Processes & IPC.
Scott!
Put the big rocks in the glass jar first!
|
|
|
|
|
"... so process is running program each thread have its own registers like ax,bx,CS:IP. Right ?"
Not my expertise, but I think so, yes.
"Use threads the same memory - memory of process ???"
Same EXE image, yes. Global variables/objects is also shared between threads within a process. Locally defined variables/objects within a thread are not shared between threads.
"can one process access threads of another process?"
Don't think so.
"one more question: is it ok to create around 20 threads/process - for example each thread for each wininet download ???"
Yes, web servers usually contain many more threads than 20. Our company has software running 50+ threads also, a lot being threads with different tasks. Word uses a separate thread to print documents too, for example.
|
|
|
|
|
A process is a thread container. The process defines the memory context in which 1 or more threads run. You can't have a process without at least one thread.
|
|
|
|
|
thanks a lot everybody, you really helped me!
|
|
|
|
|
I'm using VC++ to implement a program involving drawing.
CABCDoc* pDoc = GetDocument();
*
*
*
GetDocument()->UpdateAllViews(0); //I use this line as "clearscreen" in the "View" file
In the Drawing function (in seperate file):
void drawing()
for (;;)
{
::receive message from outside (peekmessage()....etc...)
CDCPointer->MoveTo(x,y);
CDCPointer->LineTo(x,y); //draw a dot
if (stop)
break;
}
I use a loop to let the program keep receive message and do drawing. If I use the UpdateAllViews(), nothing special. But after that when I want to terminate this drawing function, error messagebox shown:
"Debug Assertion Failure!
Program: c:\ABC......\ABC.exe
File: Wingdi.cpp
Line: 557
For information.........."
If I didn't use UpdateAllViews(), no problem at all......but if I exit the function and want to do it again....I have to clear the screen first, right?
I can use the UpdateAllViews() anywhere to do the clearscreen.......can anyone help me?
|
|
|
|
|
More information please, where exactly are you calling UpdateAllViews()...
Wayne
|
|
|
|
|
Actually, I do drawing by the touchscreen. So I have to receive the message from touchscreen, then do drawing. So I use;
First:
In CABCView.cpp
WindowsProc(...)
{
get the message and information from touchscreen (get x and y)
if (alignment finished)
GetDocument()->UpdateAllViews(); //if i finished doing the alignment, clear the screen and
//start doing the drawing....***problem is in here***....
}
Second:
OnDraw()
{
.....call the drawing function in drawing.cpp
}
In drawing.cpp
Third:
DrawDot()
{
for ( ; ; )
{
if (alignment == true) //doing the alignment first (print out 4 points to let user touch first)
{ start doing thing.........CDCPointer->MoveTo(x,y)..etc....
if (stop)
break;
}
}
}
So the process is liked that: Start DrawDot(), then do alignment, receive points info., clear screen, start drawing........
If I didn't clear screen after alignment, that's ok...and no error message shown after i leave the function. However, if i run the function again, nothing shown and i try hard to stop the function and then show the same error message...( i think it is because after i exit the function, i use UpdateAllViews() to clear the screen....then when i go back to this function.....same problem....)
If I did clear screen after alignment, error message will show right after i leave the function and terminate the whole program. Also, when i do the drawing, the output is different compared to those i didn't clear screen after alignment. I am drawing downward...but on the screen is going up....something liked that.......
Hope this information can help you.
|
|
|
|
|
If I search a file with:
CFileFind fFind;
find.FindFile("*.bmp");
find.GetFilePath();
the programm crashes.
MSDN says that I must call FindNextFile() at least once, but then I get the path of the second file and not of the first.
So, how can I get the path of the first file?
|
|
|
|
|
There seems to be a bug in the MFC class of CFileFind. Use instead FindNextFile() of the Win32 Platform SDK.
|
|
|
|
|
No, there is no bug. You have to call FindNextFile at least once just like the documentation states.
Basically this is what you do.
CFileFind fFind;
BOOL bFound = fFind.FindFile( "*.bmp" );
while ( bFound )
{
bFound = fFind.FindNextFile();
// Do what you want with fFind, it is pointing to the first found file.
}
Hope that helps
Wayne
|
|
|
|
|
Dear all,
I want to create button at run time, but, I don't know how many button I will create at
Run-Time. It decide by database. So please tell me how to do it ??
I can create it when I know how many button I will create. Just like :
add "#defint MyButton1 1111" , "#define MyButton2 1112", ect ....
and add "CButton m_Button1", "CButton m_Button2", .....
then m_Button1.Create(), m_Button2.Create(), ......
But that not I want, if at Run-Time, there have 100 button to create, then ..... >_<
Please help me, thanks .....................
|
|
|
|
|
Basically, you should have a CButton * in your class, and create it to be an array of buttons. Given them ID's starting from a specific value, then you can use PreTranslateMessage to catch which button has been pressed.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Sorry,
I don't understand how to create it to be an array ....
can u teach me ??
thanks
|
|
|
|
|
Can anyone help me, I've got a form with a button on it that I want to activate another form with separate database, can anyone point me in the direction of a good tutorial or give any help. I'm working in v6 and access. Thank you.
Crusty
|
|
|
|
|
I have create an application that has been grow quite quickly in the months running up to its release.
After the app was delivered to our main customers that there was a problem with the software when in was running under Windows 95.
The problem is based around failing to load icons and cursors from the resources.
I have been using the standard LoadIcon etc, but under Win95 the LoadIcon is returning NULL.
The problem may be larger than that as I have noticed that the Icon that sits at the top left of the app window in not the one specified but the default one (a grey box).
Does anybody have any idea what the problem could be.
Please help it's driving me mad.
|
|
|
|
|
I have a similar (but different) problem with animated cursors in the app's resources. Strangely, when I build with Static MFC Libs my call to LoadIcon returns NULL, while it works perfectly with MFC DLLs. This happens both in Debug and Release builds.
I tried every method to load an icon from the resources:
HCURSOR hAniCur = ::LoadCursor(AfxFindResourceHandle(MAKEINTRESOURCE(IDR_HOURGLASS),
RT_ANICURSOR), MAKEINTRESOURCE(IDR_HOURGLASS));
HCURSOR hAniCur = (HCURSOR)LoadImage(NULL, GetModuleHandle(NULL),
MAKEINTRESOURCE(IDR_HOURGLASS), IMAGE_CURSOR, 0, 0, LR_DEFAULTCOLOR);
HRSRC hResInfo = FindResource(NULL, MAKEINTRESOURCE(IDR_HOURGLASS), _T("ANICUR"));
DWORD dwResSize = SizeofResource(NULL, hResInfo);
HGLOBAL hRes = LoadResource(NULL, hResInfo);
PBYTE pResData = (PBYTE)LockResource(hRes);
HCURSOR hAniCur = CreateIconFromResource(pResData, dwResSize, FALSE, 0x00030000);
None of these methods works when linking with static libraries. I found a work-around some time ago, that can seem absurd, but really works on Win2000 and Win95, but not on WinME (and possibly others):
HRSRC hResInfo = FindResource(NULL, MAKEINTRESOURCE(IDR_HOURGLASS), _T("ANICUR"));
DWORD dwResSize = SizeofResource(NULL, hResInfo);
HGLOBAL hRes = LoadResource(NULL, hResInfo);
PBYTE pResData = (PBYTE)LockResource(hRes);
PBYTE pResCopy = new BYTE[dwResSize];
MoveMemory(pResCopy, pResData, dwResSize);
HCURSOR hAniCur = CreateIconFromResource(pResData, dwResSize, FALSE, 0x00030000);
That is copying the just loaded icon makes the system happy.
I finally gave up when I tried this on ME...
But I suspect a bug in the resource compiler, because when I remove *all* the standard MFC resources automatically included in the app's resource script, everything is fine even with static libraries.
I also tried to extract my app's resources with other tools, to see if they were ok, I even compared the extracted resources with those of my dinamically linked app, but they were identical.
What to say? I even thought to download debug symbols for my system DLLs, to debug the call to LoadCursor and the others... but I have no will to do it.
All my comprehension,
Paolo.
|
|
|
|
|
HI ALL
How I can play mp3 files from my program
any one can tell me how I can play mp3 files from my
program (by visual c++6) or tell me about web sites about mp3 files
THANK YOU
AHMAD ALWASHALI
|
|
|
|
|
Hi
go to the site www.xaudio.com
You'll find a SDK ( free !!!!!) to build in MP3 support in your apps
HTH
Thierry
EMail: Thierry.Marneffe@swing.be
|
|
|
|
|