|
hai
Thanks for fast response.
I have drawn a few lines by instantiating class and I stored the pointers
to objects in a list.now I want to select a particular line using this list of pointers.If I want to select a line to resize or drag it.for that purpose how can I get the pointer to particular object?I used pointers.I have written it in vc++.
Thanks again.
bhikshapathi_g@semanticspace.com
|
|
|
|
|
Now this is a little different. I presume you've got a list of pointers to objects that tell you the points you've drawn lines between ? If not, then you do not have a prayer, but I'm not sure if you do because if you do then your original question was too vague to be answerable.
You need to iterate through your list of points and figure out if the point you have selected sits on one of the lines. I've had a quick scan of 'principles & practice' but cannot see an algorithm for finding if a point is in a line. ( I'm sure it's there, but it's early and I am tired ). One way to do it would be
a/ find out first if the point is in the bounding box of the two points.
b/ figure out the ratio between x and y.
c/ apply that ratio to the x value of your point and see if the y value corresponds within an acceptable margin.
I suspect something with paths is also possible.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
I want to add column in Data Grid control... The DataSource is from ADO.... I can display all the columns if i did not set the the columns.... If i set the columns i can only set 2 columns.. How to increase the columns so that i can display more than 2 column and format the columns...
URGENT!!!!!!
THANX!!!!!
|
|
|
|
|
Hello,
Well I am a novice and here is my novice question.
I have Created an SDI app. from the File menu, choosing Open Brings up a CFileDialog.
Now how do I get the file that was selected from this Dialog.
Is there a member var of CMainFrame?
Does it Automatically update the ActiveDocument? If So What does it update?
Im basicly confused on where the filePath I selected in the CFileDialog is stored.
Any Help would be Great
|
|
|
|
|
OnOpenDocument in your document class receives a path name.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
|
In the command line type
IPCONFIG /ALL
or
#include <windows.h>
#include <winsock.h>
#include <wsnetbs.h>
#include <wsipx.h>
#include <stdio.h>
#pragma comment(lib, "ws2_32.lib")
main()
{
struct hostent FAR *pHostAddr;
struct in_addr in;
char pszHostName [ 255 ];
int err;
WORD wVersionRequired;
WSADATA wsaData;
wVersionRequired = MAKEWORD(1,1);
err = WSAStartup(wVersionRequired, &wsaData);
if (err != 0)
exit(1);
if (gethostname (pszHostName, sizeof(pszHostName)) != SOCKET_ERROR)
{
printf("Local Host Name: %s\n", pszHostName);
}
else
{
printf("gethostname error: %ld\n", WSAGetLastError());
exit(-1);
}
pHostAddr = gethostbyname ( pszHostName );
if (pHostAddr == NULL)
{
printf("gethostbyname error: for %s\n",pszHostName);
exit(-1);
}
else
{
printf("Host Name: %s\n", pHostAddr->h_name);
printf("Address Type: %x\n", pHostAddr->h_addrtype);
printf("Address Length: %d\n", pHostAddr->h_length);
printf("Host Address: %lx \n", pHostAddr->h_addr);
in.s_addr = *((u_long *)pHostAddr->h_addr);
printf("Dotted Address: %s\n", inet_ntoa(in));
}
}
Cheers
Alfadhly
/*
It is Illogical to define an inventor by his invention
*/
|
|
|
|
|
I have an dialog (CAxDialogImpl<>) that I have placed a MSChart20 control on. On my W2K dev box it works fine. When I move the application to Win95 the app crashed windows to a blue screen the Create() method is called. I can run a VB app on the machine that uses the chart control just fine, so I am resonable confident that the control is installed correctly. The control was added via the "Insert ActiveX control" dialog in the resource editor. I am calling CoInitialize(NULL), so I don't think anything in the app is marked as a multi-threaded environment. Has any body seen this before and have suggestions?
TIA!
Nate
|
|
|
|
|
Better check again on the OCX. What you are describing is the result of either not having the control or not have having it registered. MSCHRT20.OCX must be on your Win 95 box. You just need to copy the control over and call from a DOS prompt: "regsvr32 mschrt20.ocx" (possibly including the path and all that). MSCHRT20.OCX is provided by the installation of Visual Studio and it's Service Packs. Therefore you will need to include it. You will also likely want to make sure that your 95 box has the latest IE installed (at least 4.0). Otherwise you'll have to find and install the latest Common Controls (which IE does for you).
Good luck.
|
|
|
|
|
Thanks for the response. I have IE 5.0 installed on the box. I also installed Visual Studio completely on the box. I can also use the chart control in VB app without problem on the same box. The control also shows up in the Insert ActiveX control dialog. Which I believe indicates that the control is correctly installed, including the design time license.
TIA!
Nate
|
|
|
|
|
When you say "The Box" are you talking about the Win2K development box, or the Win95 box you are having the trouble on? Maybe I misunderstood, but I thought you developed on Win2K with no problems but the program blew on Win95... What I'm saying is that to run the program on any other box, you have to include both the EXE (program) and the OCX (registered).
|
|
|
|
|
The app / control works fine on W2K where it was developed. The app crashed Win95 to a blue screen. As part of the troubleshooting process I then installed Visual Studion on the Win95 machine that was crashing. The application still crashed the OS. I wrote a sample VB that displayed the chart correctly on the Win95 machine, no crashes. I wrote a simple ATL app that had the chart in a dialog, it still crashed the app. If I take the control out of the dialog, the ATL app runs fine. I can add other ActiveX controls to the ATL app and the dialog shows correctly, the calendar control for example. One difference I noticed is that the chart control is marked as single threaded while the calendar control isn't? Is this a threading issue? I did try the ATL app on Windows ME machine, while it didn't crash the OS, an error was displayed where the chart should have been. Any further ideas?
TIA!
|
|
|
|
|
Well, I got into some reading on this and learned a few new things.... though all it LOOKS like I can do is POSSIBLY point you in the right direction (I will, however, probably try this myself in a little while). At any rate, the gyst of this problem MIGHT be the following:
....
Most of the Microsoft OCX's (and many others, too) are *licensed*. There are
two types of licenses: Runtime and Development license. The runtime license
is hardcoded in the control (If you build a control using Visual Basic, you
can set the property "license required", for example). The Development
license is stored in the registry.
The control does two things if it's called. First it checks wether it was
called with the correct license key given by the calling application as a
parameter(runtime license). If this fails it looks into the registry for the
development license. If this fails too, an error is produced, and the
control does not show up (this is, what happens on your client PC)
If you build an Visual Basic Application which uses one of these licensed
controls, Visual Basic knows that this control needs a license and
integrates it into the application. The application initializes the control
now with the correct license key.
UNIFACE can't do this. The OCX license is not integrated into the UNIFACE
application. Therefore the control looks for the development license, which
isn't installed on your client PC's.
....
Good luck.
Matt
|
|
|
|
|
Heh, oops. Now I'm replying to myself...
Anyway, the deal is (I think) that the Microsoft Chart Control seems to come from basically, 2 separate places (that I know of). If you set it up as follows, you SHOULD get the license (which I think is just a registry key) set up for you so everything works normally.
1) Install Office which sets up everything you need though obviously we can't make that a requirement!
2) Install Visual Basic... I know you said you installed Visual Studio on the 95 box... but did that include VB? Theoretically this control is part of the VB package.
Also, read a little about licensing from here:
http://groups.google.com/groups?hl=en&lr=&safe=off&ic=1&th=23637427a52818fd,3&seekm=981994291.815525%40callisto#p
Matt
|
|
|
|
|
Hum... never looked into the license issue. Yes I installed VB, VC++, and the "Additional ActiveX controls" from the VS install. Terminating the OS seems to be a harsh failure for not having the correct license I would be very interested to see if it works for you!
Thanks!
|
|
|
|
|
I'll take a look. As for the BSD, I'll bet that's just because Windows 95 sucks. Still, I'll give it a shot myself and see what happens.
|
|
|
|
|
Thanks! I would be happy to send you sample code tonight if that makes it faster for you.
nwilhelmi@home.com
|
|
|
|
|
Sure, go ahead. Better send it to mphilmon@noregon.com instead of my address on here. My DSL line is down right now and I'm actually having to use Dial-up access at home. I work at Noregon so their T1 will be a much easier download.
|
|
|
|
|
I'm trying to make Chris's grid control support Unicode copy / paste operations. I've got paste working fine but I can't figure out the copy... The relevant function is below with the parts I've modified in the #ifdef, #endif blocks... It copies the first part of a string but then gets garbeled. Also, if I copy from multiple cells, everything is pasted into a single cell. Where am I going wrong here (I'm guessing I'm not converting between ANSI / Unicode somewhere and mixing the two in the same buffer - but where)
Changing the CacheGlobalData() parameter from UNICODETEXT to just TEXT fixs the formatting problems, but isn't what I'm looking for (for obvious reasons). I'm pasting between my app and Excel and vice versa using Arial Unicode MS font...
Any help much appreciated...
COleDataSource* CGridCtrl::CopyTextFromGrid()
{
USES_CONVERSION;
CCellRange Selection = GetSelectedCellRange();
if (!IsValid(Selection))
return NULL;
if (GetVirtualMode())
SendCacheHintToParent(Selection);
CSharedFile sf(GMEM_MOVEABLE | GMEM_DDESHARE | GMEM_ZEROINIT);
CString str;
CGridCellBase *pCell;
for (int row = Selection.GetMinRow(); row <= Selection.GetMaxRow(); row++)
{
if( m_arRowHeights[row] <= 0 )
continue;
str.Empty();
for (int col = Selection.GetMinCol(); col <= Selection.GetMaxCol(); col++)
{
if( m_arColWidths[col] <= 0 )
continue;
pCell = GetCell(row, col);
if (pCell &&(pCell->GetState() & GVIS_SELECTED))
str += pCell->GetText();
if (col != Selection.GetMaxCol())
str += _T("\t");
}
if (row != Selection.GetMaxRow())
str += _T("\n");
#ifdef _UNICODE
sf.Write( str, str.GetLength() );
#else
sf.Write(T2A(str.GetBuffer(1)), str.GetLength());
str.ReleaseBuffer();
#endif
}
TCHAR c = '\0';
sf.Write(&c, 1);
if (GetVirtualMode())
SendCacheHintToParent(CCellRange(-1,-1,-1,-1));
DWORD dwLen = (DWORD) sf.GetLength();
HGLOBAL hMem = sf.Detach();
if (!hMem)
return NULL;
hMem = ::GlobalReAlloc(hMem, dwLen, GMEM_MOVEABLE | GMEM_DDESHARE | GMEM_ZEROINIT);
if (!hMem)
return NULL;
COleDataSource* pSource = new COleDataSource();
#ifdef _UNICODE
pSource->CacheGlobalData(CF_UNICODETEXT, hMem);
#else
pSource->CacheGlobalData(CF_TEXT, hMem);
#endif
return pSource;
}
|
|
|
|
|
This might be it:
sf.Write(str, str.GetLength() * sizeof(TCHAR));
|
|
|
|
|
Bingo. Can't believe I missed that... Thanks!
|
|
|
|
|
I have created an SDI application with an extensive dialog-based interface for a project at work.
I would like to create a new SDI application and import my existing interface classes and dialog GUIs. Is this possible?
Is there a dialog "import" capability in VC++ that I could use to load existing interfaces into a new project, or do I have to directly edit any files?
Thanks,
Kim Rudeen
|
|
|
|
|
I always copy and paste from the .rc and resource.h files to move dialogs between programs. You can also specify extra resource files, but I've never really learned how because it seemed messy and getting dirty with the text files gives me a feeling of control that appeals to my rapidly dwindling sense of manhood.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Hello,
I have a simple Dialog Box with 2 Timers. One displays the current time ,the other is a Count down timer. When the count down timer reaches a certian time I would like it to display a simple MessageBox.. Here is a sample of the OnTimer(UINT nIDEvent)code where I think I should place the code to display the MessageBox..
void CTimerDlg::OnTimer(UINT nIDEvent)
{
//Which timer triggered this event?
switch (nIDEvent)
{
//The Current Time?
case IDC_TIMER1:
//Display the current time
m_timer1.DisplayCurrentTime();
break;
//The Count Down Timer?
case IDC_TIMER2:
//Increment the count
m_iCount--;
//format and display the count
m_timer2.Display(m_iCount,iM,iH,iD,(CString)m_strTimer2="%D:%H:%M:%S");
break;
}
UpdateData(FALSE);
CDialog::OnTimer(nIDEvent);
}
Any Ideas would be appreciated!!!
THANKS!
Rob
|
|
|
|
|
You might like to put UpdateData() at the top of this, I assume the variable being decrimented is in a dialog box ? Apart from that, it's self evident. Check the timer variable for the value you want, and pop up the dialog if it matches.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|