|
How do I make a simple C solution in VS.NET??? just a C console application...
/\ |_ E X E GG
|
|
|
|
|
doesn't look like there is a way.
maybe you could start with a C++ console app then take out the stuff you don't need, and add a .C file.
i needed to start a Win32 DLL in VS.Net last week. there's no way to do that either. so, i started on in VC6, then opened it in VS.Net.
-c
CheeseWeasle
|
|
|
|
|
Chris Losinger wrote:
i needed to start a Win32 DLL in VS.Net last week. there's no way to do that either. so, i started on in VC6, then opened it in VS.Net.
Sounds like a hassle.
-Nick Parker
|
|
|
|
|
First, I assume you mean a simple C++ console app. No reason to use C.
To do this in VC.NET 2003 (2002 will be similar):
Click File|New|Project.
Click on "Visual C++ Projects"
In the right hand list box, scroll down to "Win32 Console Project"
Enter the name and location in the appropriate spots and click "OK".
(You can also select "Win32 Project." When the wizard comes up, click on "Application Settings" on the left and then "Console Application", and any other options on the right.)
|
|
|
|
|
I would like to write a short application using Wininet that interacts with search engines of websites that use php scripts and specifically the POST method to search their database. Where can I find some information concerning these topics?
|
|
|
|
|
I'm having a problem using AnimatePalette. My application's main window is a CFrameWnd subclass with a CView subclass. The CView handles WM_PALETTECHANGED and WM_QUERYNEWPALETTE. All of the graphics in the view are done in child windows. These windows are all of a subclass of CWnd. All are transparent, as they are graphics overlaid on to frame-grabbed video displayed by the CView. Some of the overlaid graphics have to blink on and off, so the parent (CView) window calls SetTimer in its WM_CREATE handler and has a WM_TIMER handler which switches the blinking palette entries from the background color (black in this case) to the foreground color (green in this case) and back by using AnimatePalette. The child windows Select and Realize the palette in their WM_PAINT handlers. This all seems to work just fine.
I have blinking graphical entities in two of the child windows. If I hide one of the windows, the entities in the other window STOP blinking! If they were "off" (i.e. background color) when I hid the sibling window, they never come back "on" (i.e. foreground color) or if "on", they never go back "off" until I show the hidden sibling window again. (I've set up an WM_KEYUP handler to hide/show the child windows).
What am I doing wrong? My CPalette is a data member of the parent (CView) window. Each of the child (CWnd) windows has a data member which holds a pointer to the CPalette object in the parent.
Bill A.
|
|
|
|
|
I have been aligning(16 byte) certain data types to allow me to use SSE commands on them, and have no problems apart from when I create instances of them on the stack, where I get a runtime exception in debug mode, complaining about the stack being corrupted when I leave the function that uses it, ie
void SomeProc()<br />
{<br />
Vector vec;
<br />
<br />
}
so I'm having to do
void SomeProc()<br />
{<br />
Vector *vec=new Vector;
<br />
<br />
delete vec;<br />
<br />
}
which is time consuming. I have implemented ways to speed it up, but I would like to know if there's a simpler way.
Thanks,
G
|
|
|
|
|
AFAIK changing the default alignment for a structure mustn't cause stack corruption issues. Maybe if you post the code for SomeProc we can spot the root of the problem.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Right: the class vector is defined thus:
#define jALIGN __declspec(align(16))<br />
<br />
typedef jALIGN struct VecData {<br />
float x;<br />
float y;<br />
float z;<br />
float w;<br />
}VecData;<br />
<br />
class Vector {<br />
public:<br />
protected:<br />
VecData m_vec;
};
and the test procedure is
Vector vec(1.0f,1.0f,1.0f,1.0f);<br />
Vector vans=mat1*vec;<br />
PVec(vans);
Where PVec just prints out the value of the vector.
mat1 is a matrix defined thus:
typedef float jALIGN jMat[16];<br />
<br />
class Matrix {<br />
public:<br />
protected:<br />
jMat m_mat;<br />
};
and the transformation function for the non-SIMD version (it happens on all versions) is
Vector Matrix :: operator * (Vector &v)<br />
{<br />
float x,y,z,w;
float vx,vy,vz,vw;
<br />
v.Get(vx,vy,vz,vw);<br />
<br />
x=( vx*m_mat[jMatIdx(0,0)] ) +<br />
( vy*m_mat[jMatIdx(1,0)] ) +<br />
( vz*m_mat[jMatIdx(2,0)] ) +<br />
( vw*m_mat[jMatIdx(3,0)] );<br />
y=( vx*m_mat[jMatIdx(0,1)] ) +<br />
( vy*m_mat[jMatIdx(1,1)] ) +<br />
( vz*m_mat[jMatIdx(2,1)] ) +<br />
( vw*m_mat[jMatIdx(3,1)] );<br />
z=( vx*m_mat[jMatIdx(0,2)] ) +<br />
( vy*m_mat[jMatIdx(1,2)] ) +<br />
( vz*m_mat[jMatIdx(2,2)] ) +<br />
( vw*m_mat[jMatIdx(3,2)] );<br />
w=( vx*m_mat[jMatIdx(0,3)] ) +<br />
( vy*m_mat[jMatIdx(1,3)] ) +<br />
( vz*m_mat[jMatIdx(2,3)] ) +<br />
( vw*m_mat[jMatIdx(3,3)] );<br />
<br />
x/=w;<br />
y/=w;<br />
z/=w;<br />
w=1.0f;<br />
<br />
return Vector(x,y,z);<br />
}
where jMatIdx is
#define jMatIdx(x,y) ( ((y)<<2) + (x) )
Hope this helps.
|
|
|
|
|
Ummm... Everything seems fine. Where is jALIGN defined? Is it possible that "vector.h" (or whatever the name of the file where Vector is defined) could be #include d in contexts where the definition of jALIGN differs?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
No, it is defined in a single header file. For the moment, as I can't get around this, I have scrapped the alignment and just rewritten the SSE code, but it is annoying!
|
|
|
|
|
hi I need to deal with a web cam So I need to know how to get data from it and wich format and how to display it but all I found in codeproject was done by C# and .NET but I need something in VC or some basic Ideas
thanks in Advanced
|
|
|
|
|
Try searching the MSDN for the example program vidcap.
If I have seen further it is by standing on the shoulders of Giants. - Isaac Newton 1676
|
|
|
|
|
SYSTEMTIME structure looks like this:
typedef struct _SYSTEMTIME
{
WORD wYear;
WORD wMonth;
WORD wDayOfWeek;
WORD wDay;
WORD wHour;
WORD wMinute;
WORD wSecond;
WORD wMilliseconds;
} SYSTEMTIME;
I have a SYSTEMTIME object I want to store in the registry. What is the best way of doing this? Must I add each member to the registry or is there an easier (more elegant) way?
Thanks
|
|
|
|
|
You might try to store it as a DWORD in the registry, but I'm not sure whether it works.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I do not understand your "answer". I can convert the SYSTEMTIME structure of 8 WORDs into 4 DWORDS perhaps, then I only have 4 keys to store, yes? How would I get 2 separate WORDs from a DWORDs? One as a low value and the other as high value?
|
|
|
|
|
Yes, that would work. There are two macros, LOWORD and HIWORD .
Or do it like Toni78 suggests, storing everything as a string.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Concatenate all of the data in one string and store it in the registry. That is if you don't want to save each member.
i.e.
CString strTime;
strTime.Format("%X-%X-%X", sysTime.wYear, sysTime.Month, sysTime.DayOfWeek );
This is just an idea and I have not tested it if it works. But I don't see a reason why it shouldn't.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
Save it as a binary value
CRegKey Key;
if (ERROR_SUCCESS == Key.Create(HKEY_CURRENT_USER, _T("Software\\My Company\\My App\\Settings"));
{
::RegSetValueEx(Key.m_hKey, _T("Time"), NULL, REG_BINARY, (LPBYTE)&MyTimeObject, sizeof(SYSTEMTIME));
} To read it back again use the ::RegQueryValueEx() function
CRegKey Key;
if (ERROR_SUCCESS == Key.Open(HKEY_CURRENT_USER, _T("Software\\My Company\\My App\\Settings"));
{
DWORD dw = sizeof(SYSTEMTIME);
::RegQueryValueEx(Key.m_hKey, _T("Time"), NULL, NULL, (LPBYTE)&MyTimeObject, &dw);
}
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Awesome! Thanks m8
|
|
|
|
|
WOW!!! I could never find a reason to use REG_BINARY.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
How do I add one of those cool list boxes that allow you to pick a color in the dialog box. I know how to add a list box to a dialog, but not how to add the color part to it.
PS -- I'm not talking about CColorDialog, I want to know how to be able to pick a color inside the dialog list box.
|
|
|
|
|
|
I am drawing directly on to a dialog and for some reason in the OnPaint() handler, if I use TextOut, text draws okay. If I replace the statement with DrawText() nothing appears. This is with DT_NOCLIP|DT_CALCRECT|DT_SINGLELINE as options. It is me or is there something deeper afoot? I am using W2K SP3 and VC6.
thanks
Adam.
My world tour
What I do now..
"I spent a lot of my money on booze, birds and fast cars. The rest I just squandered"
George Best.
"I suppose if it was a choice between bon jovi and the interior of a car, the car would win, even it didnt have a radio and I had to sit in silence" James Simpson on Light Metal.
|
|
|
|
|
From MSDN:
DT_CALCRECT
Determines the width and height of the rectangle. If there are multiple lines of text, DrawText uses the width of the rectangle pointed to by the lpRect parameter and extends the base of the rectangle to bound the last line of text. If there is only one line of text, DrawText modifies the right side of the rectangle so that it bounds the last character in the line. In either case, DrawText returns the height of the formatted text but does not draw the text.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|