|
I see I need to start from the beginning. When the text is a different colour, chances are it's a hyperlink. To tell for sure, move your mouse over it and look in your status bar for a URL. Then click on the URL I provided for you in my last post, and you'll see the appropriate article online. It is most certainly also in the latest MSDN, and every MSDN since 1995, assuming they had them back then.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
Thank you, I got it
I'm amumu, and you?
|
|
|
|
|
The General Equation is:
// line one
A = pt2.y - pt1.y;
B = pt1.x - pt2.x;
C = pt1.x*A + B*pt1.y;
// line two
D = pt4.y - pt3.y;
E = pt3.x - pt4.x;
F = pt3.x*D + E*pt3.y;
DET = A*E - B*D;
if(fabs(DET) < DTSQ) // Paralell lines skip
{
// Paralell
}
else
{
// intersecting point
x = (E*C-B*F)/DET;
y = (A*F-D*C)/DET;
}
// DTSQ is deterimined by the accuracy you have (i.e. what is considered to be zero.)
example DTSQ=0.00001f
//Now is this point on the segement or not for each side of the rect you have. It may miss be on two sides or a corner.
Good ideas are not adopted automatically.
They must be driven into practice with courageous patients. -Admiral Rickover. ...
|
|
|
|
|
Thanks Michael, this is an excellent little piece of code. I knew there had to be an easy way of doing this and you nailed it I am going to add this code to my file of assorted functions.
Someone, with more knowledge in this area than me, should write an article containing a bunch of geometric functions like this one (or does one already exist somewhere?)
---
CPUA 0x5041
Sonork 100.11743 Chicken Little
It may be that your sole purpose in life is simply to serve as a warning to others.
|
|
|
|
|
First you are welcome
I thought Chris was going to write something, but I am not sure where it would be. I have a number of functions coded through the years. Mostly to support Finite Element Editors. That is part of the issue on what area to write for. I am sure if you did a search on google for the right set of terms you will find sources.
Good ideas are not adopted automatically.
They must be driven into practice with courageous patients. -Admiral Rickover. ...
|
|
|
|
|
I recently installed Visual Studio .NET and at times I feel a bit lost in the new development enviroment. For some reason I can't figure out I can't load a bitmap from a resource file. Obviously I'm not doing everything that I should. I'm doing a Win32 application, and not using MFC.
HBITMAP hBitmap; // global
// inside the message pump (WM_CREATE)
hBitmap = LoadBitmap(hThisInstance, "MyBitmap");
When I run the app I get the error code saying ERROR_RESOURCE_NAME_NOT_FOUND (the specified resource name cannot be found in the image file).
In the project I add a new bitmap resource, change the filename resulting in that Visual Studio load the bitmap into the Bitmap Editor. Visual Studio also gives the bitmap resource an ID, and I change this ID into a string called "MyBitmap". Using the Visual Studio resource identifier, after converting the ID using MAKEINTRESOURCE, results in the same error. Everything worked fine when using VC++ 6, so I'm getting a bit frustrated here. Help me please! Thanks a million!
|
|
|
|
|
can anyone tell me plz how to make a listbox appear on a CEditView plz. It's very important to me to make a ListBox appear at runtime.
Thanks in advance
Bernard Racoute
Mail @ bracoute@hotmail.com & Bracoute@hotpop.com
Bracoute
|
|
|
|
|
i got the wabapi.h thing sorted out (i think) but now am hitting other problems
what i'm trying to do is use the windows address book in my app and apparently i have to jump thru several hoops wearing a pink tutu to do it (sheesh cant they make this stuff easier!) ... anyways i got this code compiling and working up to the indicated line ... at which point i get an access violation ... *sigh*
any clues would help a lot
---------------------------------------
HRESULT CL4m3Dlg::InitWAB (LPWABOBJECT *lppWABObject,LPADRBOOK *lppAdrBook)
{
HRESULT hr = E_FAIL;
CString csKey;
CString csDllPath;
CString csDefault;
WAB_PARAM wbp;
wbp.cbSize = sizeof(WAB_PARAM);
wbp.hwnd = NULL;
wbp.szFileName = NULL;
wbp.ulFlags = 0;
CRegistry cr;
cr.SetRootKey(HKEY_LOCAL_MACHINE);
cr.SetKey(WAB_DLL_PATH_KEY,false);
csDllPath = cr.ReadString(csDllPath,csDefault);
// hinstWAB = LoadLibrary_WABDll(); <--- dunno what this is
hinstWAB = LoadLibrary(csDllPath);
if (hinstWAB){
lpfnWABOpen = (LPWABOPEN) GetProcAddress(hinstWAB, "WABOpen");
if (lpfnWABOpen)
----------> access violation happens on this line
hr = lpfnWABOpen (lppAdrBook,lppWABObject,&wbp, 0);
}
return hr;
}
-------------------------------------------------
---
"all's fair in love and war but in love there is no geneva convention"
|
|
|
|
|
Hmm... have you got your program incrementing the reference
count for the WAB dll in the registry ok?
Assuming you have, I think it is something to do with
the Loadlibrary statement... I know the usual syntax is:
LoadLibrary(file name string);
Have you checked that csDllPath is being loaded with the
correct path to the dll before calling LoadLibrary?
If that's ok then....
What happens when you use:
hinstWAB = LoadLibrary_WABDll();
Or:
hinstWAB = LoadLibrary_WABDll(csDllPath);
Instead of:
hinstWAB = LoadLibrary(csDllPath);
|
|
|
|
|
loadlibrary_wabdll() isnt recognized by the compiler thats why i commented it out and did a normal loadlib call
:/
---
"all's fair in love and war but in love there is no geneva convention"
|
|
|
|
|
|
Hi !
I want to ask how one make a bitmap (a picture) transparent in MFC.May a picture Control be transparent ?
|
|
|
|
|
|
I know that C++ is used on OSs like Unix, but is there a way to have VC++ compile my apps rather than have to copy it to the target machine every time. Is there an add-on that allows the creation of Linux, MacOS apps using VC++ 6?
I'm not late, I'm just not as early as I could have been.
|
|
|
|
|
No, VC6 is very much a Windows only compiler.
VC 4.2 used to have an add-on to compile MAC OS apps but Microsoft discontinued that a long time agon.
Michael
|
|
|
|
|
So the only way to make an app for MacOS is to use a Mac and get a software compiler for the MacOS.
Are there no freeware/sharware/commercial products for a windows machine that compiles and links a MacOS App?
I'm not late, I'm just not as early as I could have been.
|
|
|
|
|
Jonny Newman wrote:
So the only way to make an app for MacOS is to use a Mac and get a software compiler for the MacOS.
CodeWarrior is the main C++ compiler for the Mac. It might do cross platform compiling. Other than that you'll have to develop Mac apps on a Mac.
Michael
|
|
|
|
|
OK thanks i'll have to save up then.
I'm not late, I'm just not as early as I could have been.
|
|
|
|
|
If you truly need to support numerous environments with a gui app, your best bet is to buy a cross platform development library and code to that rather than MFC. At one of the telcos I worked at, they were using ZApp for that purpose (personally, I hated the constraints since the product I was working on was Windows only and MFC was more familiar).
Do a search on the net for cross platform libraries and you'll come up with a number of solutions that cover Windows, Mac & Unix.
Chistopher Duncan
Author - The Career Programmer: Guerilla Tactics for an Imperfect World (Apress)
|
|
|
|
|
Is there a way to know if a window have a particular style (ex : WS_EX_LAYERED) ?
I know GetWindowLong(hWnd, GWL_EXSTYLE), but I don't how to ckeck ONE style with this function.
Thanks for your help
|
|
|
|
|
if ((GetWindowLong(hWnd, GWL_EXSTYLE) & WS_EX_LAYERED) != 0)
...
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Hi,
I want to encrypt the password & store it in registry.Also i should be able to decrypt the string.
How can i do that?
|
|
|
|
|
There are a few libraries available on
the net that contain ready made encryption functions..
One of the more popular ones is called cryptpak or
something similar, and contains quite a few popular
encryption algorithms like DES, Blowfish etc.
Or you could write your own encryption functions - try
searching for encryption algorithms on google and you
should find a few sites that explain the basics of how
to write code to encrypt data.
|
|
|
|
|
There are several Crypto articles here on CP. Also Windows includes Crypto functions. And finally look at Crypto++ http://www.eskimo.com/~weidai/cryptlib.html
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
Neville Franks wrote:
There are several Crypto articles here on CP
There is...?
I've only seen the one implementation on CBlowFish...perhaps you could direct me to another...?
Thanx!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|