|
Does anyone know of a CVS plug-in for VisualStudio.NET? Cheers
|
|
|
|
|
hi,
I saw the API'S called ,while notepad or any window based application through one utility called API spy.Here I thought that the basic window that OS is painting/Drawing is through the GDI.But the list of Api's I got is not suffient to draw a window. It just shows me normal user done painting like TextOut\BitBlt..etc not the actual windows painting.
How the actual windowing system gets painted? I meant,It is using only a GDI or something else is also uner the Hood?
Vikram
|
|
|
|
|
It's been quite a while since I've looked at my old coding projects (nearly a year) and now trying to get it to work on Visual C++ rather than Linux/cygwin I find it doesn't quite work
I got stuck here. Vertex is a class that I've defined. The error for this code is list' : use of class template requires template argument list
void inline LeftEdge(list<Vertex>::const_iterator &itr, const list<Vertex> &list, const int dir)<br />
{<br />
switch(dir)<br />
{<br />
case -1:<br />
itr++;<br />
if (itr == list.end())<br />
itr = list.begin();<br />
break;<br />
case 1:<br />
if (itr == list.begin())<br />
itr = list.end();<br />
itr--;<br />
break;<br />
default: break;<br />
}<br />
}<br />
<br />
void inline RightEdge(list<Vertex>::const_iterator &itr, const list<Vertex> &list, const int dir)<br />
{<br />
if (dir == 1)<br />
LeftEdge(itr, list, -1);<br />
else LeftEdge(itr, list, 1);<br />
}
And this doesn't work either.
list<Vertex>::iterator erase[vertexList2D.size()];
Any help or insight would be greatly appreciated, thanks!
|
|
|
|
|
What about the fact that you have the list template datatype, and you are trying to name one of your variables list?
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
opps, I thought I used the <> formatting...instead of
list<Vertex>
it should be
list<Vertex>
I'm using the list template datatype and you're right I should've passed in the parameter list<Vertex> &vertexList2D like I have everywhere else rather than list<Vertex> &list
Now I have to figure out what I was trying to do with list<Vertex>::iterator erase[vertexList2D.size()];
|
|
|
|
|
I'm currently working on a project for college where we (our project group) attach a unit we built to the serial port and interact with it using software.
Everything works great... to a point...
We call WaitCommEvent() which sets our thread (we created) in a block state and when a character is sent (from our hardware unit through the serial port), the software processes it properly... HOWEVER.... my problem is that...
The ONLY thing that breaks the WaitCommEvent() is hardware interaction....
The main program (that spawns the thread running the WaitCommEvent) cannot kill the thread or somehow interrupt the wait event.
I'm only an amateur at this, and have gotten this far by getting lost in the MSDN libraries... but I'm stumped on this one...
Does anyone know any little tricks I can do or any way I can modify my code so I can lift the WaitCommEvent() suspend state using software interaction. Then allowing me to terminate the thread?
lead2gold
|
|
|
|
|
I would stay away from WaitCommEvent myself. In the past I have always configured my comm port such that when you do a WriteFile() it returns after all output characters have actually been sent and the receive returns immediately regards on whether any characters were read or not - you can then check the number of characters received. I do this in a loop with regular Sleep()s in it and a while (!bKillYourself) flag which can be set externally.
Somthing like this: (A quick hack of one of my projects)
DWORD dwNumBytesRead;
DWORD dwNumBytesWritten;
SECURITY_ATTRIBUTES sa;
sa.nLength = sizeof(SECURITY_ATTRIBUTES);
sa.lpSecurityDescriptor = NULL;
sa.bInheritHandle = true;
m_hSerialPortHandle = CreateFile((LPCTSTR)m_csCommPortName,
GENERIC_READ | GENERIC_WRITE,
0,
&sa,
OPEN_EXISTING,
0,
0);
if (m_hSerialPortHandle != INVALID_HANDLE_VALUE)
{
m_bOpen = true;
if (!GetCommState(m_hSerialPortHandle, &m_DCB))
{
text = "Serial port DCB failure.";
::SendMessage(m_hwndParent, UWM_UC_STATUS, (LONG)(LPCTSTR)text, 0);
}
else
{
m_DCB.BaudRate = CBR_9600;
m_DCB.ByteSize = 8;
m_DCB.Parity = NOPARITY;
m_DCB.fParity = false;
m_DCB.StopBits = ONESTOPBIT;
m_DCB.fDtrControl = DTR_CONTROL_DISABLE;
m_DCB.fOutxCtsFlow = false;
m_DCB.fDsrSensitivity = false;
m_DCB.fTXContinueOnXoff = true;
m_DCB.fOutX = false;
m_DCB.fRtsControl = RTS_CONTROL_DISABLE;
m_DCB.fAbortOnError = false;
if (!SetCommState(m_hSerialPortHandle, &m_DCB))
{
text = "Serial port set com status failure.";
::SendMessage(m_hwndParent, UWM_UC_STATUS, (LONG)(LPCTSTR)text, 0);
}
if (!SetCommMask(m_hSerialPortHandle, EV_RXCHAR))
{
text = "Serial port set com mask failure.";
::SendMessage(m_hwndParent, UWM_UC_STATUS, (LONG)(LPCTSTR)text, 0);
}
COMMTIMEOUTS timeouts;
timeouts.ReadIntervalTimeout = MAXDWORD;
timeouts.ReadTotalTimeoutConstant = 0;
timeouts.ReadTotalTimeoutMultiplier = 0;
timeouts.WriteTotalTimeoutConstant = 0;
timeouts.WriteTotalTimeoutMultiplier = 0;
SetCommTimeouts(m_hSerialPortHandle, &timeouts);
}
}
else
{
text = "Unable to open serial port \"" + m_csCommPortName + "\"";
::SendMessage(m_hwndParent, UWM_UC_STATUS, (LONG)(LPCTSTR)text, 0);
m_bThreadDead = true;
return;
}
while (!m_bKillThread)
{
ReadFile(m_hSerialPortHandle, szInputBuffer, 1, &dwNumBytesRead, NULL);
if (dwNumBytesRead == 1)
{
}
}
CloseHandle(m_hSerialPortHandle);
m_bOpen = false;
m_bThreadDead = true;
m_bKillThread = false;
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
Thanks!
I will try that immediately and post my success (hopefully) ...
The hardware unit we built is kinda dumb, it can only send characters not read (thus I won't be using the write function)... but i will take what you've posted and see if i can play with it to make it work for me.
Once again, thanks alot!
lead2gold
|
|
|
|
|
Like almost any file IO in Win32 WaitCommEvent() supports overlapped IO. This means that your call to executed asynchronously by the IOManager in background. You receive the results via the OVERLAPPED structure passed as last parameter.
Overlapped IO is discussed in detail in MSDN.
--
Daniel Lohmann
http://www.losoft.de
(Hey, this page is worth looking! You can find some free and handy NT tools there )
|
|
|
|
|
Yea, we tried that, I have no idea how Overlapped works even with the MSDN libraries. (we used them to get as far as we did)
it seems as though if WaitCommEvent() is spawned (with it's parameters existing within a class)
and then
ComSetEvent() is executed from another thread with it's parameters existing fromt he same class, it is suspended until WaitCommEvent is complete. Is this true?
lead2gold
|
|
|
|
|
Aehm, more or less.
Overlapped IO is a feature of the NT Executive (Kernel) and the Win32 API and not related to any classes. The IO Manager (a component of the Executive) executes IO request always asynchronously - if you don't use overlapped IO the calling thread is just blocked until the IO is completed. (In other words: Inside the kernel non-overlapped IO is simulated by using overlapped IO)
However, I am sure you that much interested in the technical details, but want to know how to use it
Overlapped IO is not difficult in general, but a lot of details have to be taken into account. If the information provided by MSDN is not enough, I'd recommend to buy a good book about Windows NT system programming, like Win32 System Programming by Johnson M. Hart. (Note: I haven't read it, but people told me that it's a quite good book).
Hope that helps!
--
Daniel Lohmann
http://www.losoft.de
(Hey, this page is worth looking! You can find some free and handy NT tools there )
|
|
|
|
|
Every little bit helps and thanks for your advice. I'll definatly look into such a purchase.
lead2gold
|
|
|
|
|
Hi all,
new to C++ programming. i am in HS and taking a C++ course right now. can you guys tell me where to find the "graphics.h" file? I don't have one on my computer. Also what exactly does this do?
Thanks
matt
Matt Millican
http://www.internetmill.com
|
|
|
|
|
Where did you find that you need graphics.h?
Is it a windows API function, a C++ libarary function, or even a reference out of a book?
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Paul,
I found some sample code on the internet and it has a line in it that is calling graphics.h.
#include <graphics.h>
Thanks
Matt
Matt Millican
http://www.internetmill.com
|
|
|
|
|
I am attempting to learn to use Microsoft's GDI+, but I cannot figure out where to get the header files. The DLL is all over the place, but none of the other files are presenting themselves...
|
|
|
|
|
You obviously did not search this site, or you'd have read my articles. You need the platform SDK, from the Microsoft site. If you're on a modem, you'll need to order the CD instead.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
It'd probably be fairly easy to make a bot that'd post random stupid VB questions, and nobody would probably ever notice - benjymous - 21-Jan-2003
|
|
|
|
|
Hi,
I did a search for this because I'm sure it must have been asked before but I could find anything so...
I think the subject says it all; I want to change the background colour of my CComboBox to an RGB colour with the least hassle possible. I don't really want to write my own ComboBox class and I don't really want to use one somebody else has written that does a million other things. I'm guessing there isn't anything as simple as .SetBkColor? I can do m_comboBox.GetWindowsDC()->SetBkColour(RGB(X,X,X)) but it doesn't seem to have an effect, even if I call Invalidate...
Any thoughts?
Thanks VERY much,
Philip
|
|
|
|
|
hi,
I got some information from MSDN just have a Look
// This OnCtlColor handler will change the color of a static control
// with the ID of IDC_MYSTATIC. The code assumes that the CMyDialog
// class has an initialized and created CBrush member named m_brush.
// The control will be painted with red text and a background
// color of m_brush.
HBRUSH CZilchDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
// Call the base class implementation first! Otherwise, it may
// undo what we are trying to accomplish here.
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// Are we painting the IDC_MYSTATIC control? We can use
// CWnd::GetDlgCtrlID() to perform the most efficient test.
if (pWnd->GetDlgCtrlID() == IDC_MYSTATIC)
{
// Set the text color to red.
pDC->SetTextColor(RGB(255, 0, 0));
// Set the background mode for text to transparent
// so background will show thru.
pDC->SetBkMode(TRANSPARENT);
// Return handle to our CBrush object.
hbr = m_brush;
}
return hbr;
}
|
|
|
|
|
I have an VC++ application that uses STL for all core logic and MFC for windowing, and is quite extensive in features. I want to enable other applications to access features of the application.
I was conisdering using COM (automation as a COM server that resides in the exe) for this purpose. Considering the latest developments, particularly .NET, is there any other preferred alternative to this?
My article on a reference-counted smart pointer that supports polymorphic objects and raw pointers
modified 29-Aug-18 21:01pm.
|
|
|
|
|
Well, you could make the classes managed for use in .NET but I'm not sure if that is what you want.
"We will thrive in the new environment, leaping across space and time, everywhere and nowhere, like air or radiation, redundant, self-replicating, and always evolving." -unspecified individual
|
|
|
|
|
well, I want it to be accessible from .NET apps as well. My familiarity with .NET is limited - what is the mechanism that I can use, if I want it to be accessible from .NET, VC++, VB etc...
I expect people to be using .NET, VB or VC++. I know COM can be used. I wanted to be sure if there is a better option avaiable.
The application is huge, and porting it to a managed one is ruled out atleast at present.
My article on a reference-counted smart pointer that supports polymorphic objects and raw pointers
modified 29-Aug-18 21:01pm.
|
|
|
|
|
To make the classes managed for use in .NET you just need to instert __gc in the class declaration. For example:
<font color="blue">public __gc class </font>yourClass
{
};
The only downside to this that I just remembered is that you wont be able to use the managed .NET class from a unmanaged program. So I don't think this would be the best option for you.
"We will thrive in the new environment, leaping across space and time, everywhere and nowhere, like air or radiation, redundant, self-replicating, and always evolving." -unspecified individual
|
|
|
|
|
Use COM.
It can run without users need to install the .NET framework.
It can be accessed from VC++ and VB
It can also be accessed from .NET-languages, because they are compatible with COM (interop)
You don't have to make a lot of managed C++ code in your existing native application.
Just my 2 cents...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
|