|
For some reason neither the VC++ SP5 upgrade or the Platform SDK install managed to setup the correct include and lib directories in VC++.
Sprudling
|
|
|
|
|
Hello,
simple question:
Can i make a shadow in my custom cursor, like the standard cursor's ?
OS : Win2000
Marco
|
|
|
|
|
Hi, i'm using VC++ 6.0 I have add the file "myprogram.exe" to my project's resource and the file's ID is "IDR_FILE1" I want a program with a button that, when pressed, will copy the file "myprogram.exe" to the targeted directory of my chosen, for example "c:\\test " What code should I write in the on button pressed function to make this work.
thank you so much for your help.
|
|
|
|
|
Check the codeproject MFC FAQ for code allowing to choose a directory. Then CopyFile(oldfilename,newfilename,FALSE); .
Hope this helps...
~RaGE();
|
|
|
|
|
I try do a webbrowser with WebBrowser2 control but I get some errors or uninstpected behaviour. I cannot find any tutorial how to use WebBrowser2 with MFC.
Do you know about any?
My main problem is, that when I press back button and there aren't any more back .html pages. A message box pops up from nowhere. How can I handle this?
|
|
|
|
|
I need to supply a data structure to a new thread as parameter when a create it. How can I do that ??
I have declared the thread as:
DWORD WINAPI CopyFolder(void* p_pvThreadParameter)
and I create it using the following instruction:
l_hCopyFolderThread = CreateThread(NULL, 0, CopyFolderThread, this, 0, &l_dwThreadId);
As fourth parameter, as you can see, I have supplied "this": so the tread can used public members of the class that has created it. This methods work correctly but i don't like it !!!! I prefer to supply to each thread its parameters !!!
I have tried to supply a point to a data structure (casting it to void). But this doesn't work !!!!
How can I do ??
Thank you very much !!!
Cristiano Galeazzi
|
|
|
|
|
I have tried to supply a point to a data structure (casting it to void). But this doesn't work !!!!
Why does it not work? It should.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
This solution compiles and runs but...
if I put a break-point inside the thread function and I check the
content of the supplied structure I find that its is empty or it
contain not valid data !!!!
Cristiano Galeazzi
|
|
|
|
|
I guess the problem is that the data you're passing is allocated on the stack instead of the heap, something like:
MyDataStructure data;
CreateThread(...,&MyDataStructure,...); The problem with this approach is that data is destroyed as soon as your function existis from the scope the variable is declared in. You will need to allocate the structure in the heap with new (and don't forget to make the thread delete it when no longer needed.)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thank you very much!!! It works as you says!!!
Cristiano Galeazzi
|
|
|
|
|
The usual solution is to allocate a struct on the heap and pass this as the thread param. However, going C++ you could do this things much more comfortable and even create your thread directly as a member function. This is demonstrated in my article Use member functions for C-style callbacks and threads - a general solution here at CodeProject. The provided header file allows you to write code like the following:
#include "win_adatpter.h"
struct DATA { int foo; double bar; };
class MyClass
{
public:
MyClass()
{
DATA data = { 4711, .0815 };
m_hThread = win::beginthreadex( this, &MyClass::ThreadStart, data );
}
protected:
DWORD ThreadStart( const DATA& data )
{
printf( "Hello, I'm a Thread and got some params: %d and %f\n", data.foo, data.bar);
return 0;
}
HANDLE m_hThread;
};
Hope this helps
--
Daniel Lohmann
http://www.losoft.de
|
|
|
|
|
Hello,
I can't get rid of error LNK2001: unresolved external symbol _errno. I asked for help concerning this last week and got some answears, thanks a lot for them , but unfortunately they didn't help.
So, at the moment the situation is like this. The starting point of my program is main() and it uses a library, that is written in C and supports MFC. The file where main is is a .c -file. Besides that file I have a few files for GUI, the library and a couple of .c -files written in C.
I should use makefile, but I'm trying to get this working first with project/settings -options and then I'll export a makefile. I have set "Use MFC in a static library" from Project/Settings/General, "Multithreaded" from Project/Settings/C/C++/CodeGeneration/Use run-time library, "Automatic use of precompiled headers through header stdafx.h" from .../C/C++/Precompiled headers. I have also forced the program to be compiled with an option /TP. I also had to deny usage of two default libraries with linking options /nodefaultlib:"libc.lib" /nodefaultlib:"libcmt.lib", because they conflicted with the library licmtd.lib.
The result is, that I get "LNK2001: unresolved external symbol _errno". The place where I get it from is inside the library written in C, that I'm using. If I used libc.lib and denied the usage of two others I would get 66 unresolved externals instead of errno and if I used only libcmt.lib, I would get 45 unresolved externals including errno.
I have the source code of that library, but I can't modify it. In that file, where I get this error from header errno.h is included, but it is inside #ifndef _INCLUDE__STDC__. Could this be the reason why errno is unresolved? The calling convention that I'm using is __cdecl, from .../C/C++/CodeGeneration/Calling convention. I tried using stdcall, but I only got some more linking errors.
I've also tried using extern "C" with all the headers written in C, and it didn't help. What I concluded, is that libc.lib includes the definition of errno, but libcmt.lib and libcmtd.lib don't.
What should I do? Would making a dll help.
-Janetta
|
|
|
|
|
As far as I can see the problem is, that the multithreaded versions of the CRT do not define errno, because it would not fit into a multithreaded environment, but you import a .lib that was linked against the single threaded CRT and therefore expects errno to be defined somewhere.
(The MT version do not define it because using a single errno variable for multiple concurrent running threads is not a really good idea).
You have to link all parts of your project (all .lib files you create on your own and the .exe) again exactly the same version of the CRT, so you got no linking conflicts. Using /nodefaultlib is only a "hack solution" and leads to problems like yours.
--
Daniel Lohmann
http://www.losoft.de
|
|
|
|
|
Thanks a lot! It works now!
It wasn't a big thing to do and now it seems obvious, but earlier it didn't.
-Janetta
|
|
|
|
|
I am facing problem of finding from where exceptions are coming. For this I started to look mapfiles generated by /MAP option in the link tab of Visual Studio editor of MSDev. But could not understand fully. I am using Dlls also with Exe file and when exception comes from Dll then its not clear how to locate the exception in mapfile using the address of exception we have gotten from execution and addresses given in mapfile
Actually my project contains one exe and 3 dlls. Now map files are there for exe and dlls as well. When exe gets exceuted there are times when exception comes from dlls. While looking map files for dlls, there is some calulation required to get the at least function name from where exception came. This caculation is needed because preferred base address given in the dll map file is different than where dll was actually loaded while executing the program. Crash address is in respect to where dll was loaded while addresses in the map file are with respect to preferred base address.
Arvind Kumar Maurya
|
|
|
|
|
The full answer to this question you can find in John Robbins's book "Debugging Applications" (Microsoft Press 2000). It contains also very nice program CrashFinder that helps to do this.
|
|
|
|
|
I found a program named "TrimmerVB"(it's a VB sample of AVI/MOV editng in DirectX 8.1 SDK).
I want to use its functions in my VC++ frame. But I don't know how to do that.
Thanks for giving any further advice.
Win2k, VC++ 6.0 SP5
|
|
|
|
|
I want two Rich edit control in my application with coloring , highlighting and selection facilities . I want to change these views into the splitter windows and then change their layout at runtime . Means fron horizontal splitting to vertical splitting . I also want a popup sort of window available for a text associated with selected word
Can anyone suggest a good class available for it.
Samir Sood
|
|
|
|
|
Hello everybody,
I try to figure something elementary:
- in my HTML page, I should have an IMG tag, with
src="MyISAPI.dll?parameter1=value1"
- the called ISAPI dll should read a bitmap file from
disk, and Write to client.
- I don't use MFC in my application.
How should I do this elementary task? What I am missing?
I tryed to send "Content-Type" header, before sending bitmap
stream, but... something I mess.
Really I need and advice, or some lines of working code.
Many thanks in advance,
Regards,
MN
|
|
|
|
|
I created a project in VS6/MFC and upgraded to VS.NET. However, I don't know how to add a handler for a toolbar button. The MSDN said in resource view, properties, ... but i couldn't find.
In my application, I put the toolbar in a MDI childframe, and handle the commands in the view.
|
|
|
|
|
If you use the default toolbar:
In your resource view you have a resource called "Toolbar". If you have a look at that, you will see a number of predefined buttons. You can add your own as well. When you have added a button, select it and press Alt+ Enter to get its properties. There you have to fill in an ID for the button.
Use this ID to add a command handler to MainFrame.cpp. Note that the ID is also seen in the String Table resource.
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
ON_COMMAND(ID_YOUR_BUTTON, OnYourButton)
END_MESSAGE_MAP()
If you have added an extra toolbar, e.g. a CDialogBar, then it is a good idea to write a class encapsulating it.
Cheers,
Fredrik
<right>Sonork ID: 100.11430:PhatBoy
"Felix qui potuit rerum cognoscere causas."
|
|
|
|
|
While iam saving the contents of the window as a bitmap file,only the portion which is visible is getting saved.iam using win32 api programming.how to make the full window save.
|
|
|
|
|
You need to get the window to draw itself in order to save it. If it's not being drawn to the screen, where do you expect to pull the bitmap from ?
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
Any one has idea for how to do this via code and the apis to use.
thanks in advance.
|
|
|
|
|
I have looked in C books but I cannot find threads available in C. So I guess I will have to use someone’s library to get thread functionality in my C programs. Can some please tell me from where can I download such a library? My basic problem is that I have made a real time scheduler in C with custom functions working as threads, the problem is that in order to have complete functionality of real time one must be able to stop the function at any time and latter resume them. That functionality is only possible with threads but simple C does not has this functionality built in. I have to compile it on windows. Please Help.
If such a solution is not possible then I will have to make a sort of a parser that will parse the functions and perform every single addition, multiplication, and division through a set of variables that I will consider registers. By storing those registers and resuming their value I might be able to achieve thread functionality. But there is another problem with that; firstly I store the functions as function pointers in an array, and latter after scheduling I pick them up from there. So is there a way that I can convert the contents of the function by that function pointer to a string so that latter I can parse the contents of the function or do I have to follow another approach. Please help with this problem as my deadline is nearing.
OnlyHuman23
|
|
|
|