|
you mean in class wizard?
|
|
|
|
|
No, you cannot use the class wizard here. You have to code it yourself.
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
can you explain more please i am a newbie in visual c++.
|
|
|
|
|
All required dll of MyApp
ADVAPI32.DLL
COMCTL32.DLL
COMDLG32.DLL
GDI32.DLL
KERNEL32.DLL
MSIMG32.DLL
MSVCRT.DLL
NTDLL.DLL
ODBC32.DLL
RPCRT4.DLL
SHELL32.DLL
SHLWAPI.DLL
USER32.DLL
I have a function to do work "Set AutoRun for My Application"
When MyApp run on WinXPpro => Okay => AutoRun on startup
but when it run on Win98SE => Windows show a ERROR MESSAGEBOX instead of MyApp
Error Picture
BOOL SetAutoRun()<br />
{<br />
<br />
#define REG_SUBKEY_AUTORUN "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"<br />
#define REG_VALUE_AUTORUN "Notebook"<br />
<br />
DWORD dwDisposition;<br />
HKEY hkSub;<br />
<br />
CHAR szFullFileName[255]; <br />
GetModuleFileName(NULL,szFullFileName,sizeof(szFullFileName));<br />
<br />
RegCreateKeyEx(HKEY_LOCAL_MACHINE, <br />
REG_SUBKEY_AUTORUN, <br />
0, <br />
STR_NULL, <br />
0, <br />
KEY_READ | KEY_WRITE, <br />
NULL,<br />
&hkSub, <br />
&dwDisposition);<br />
<br />
if(dwDisposition==REG_OPENED_EXISTING_KEY)<br />
{ <br />
if(RegSetValueEx(hkSub,REG_VALUE_AUTORUN, 0,REG_SZ,(LPBYTE)szFullFileName, strlen(szFullFileName)+1) != ERROR_SUCCESS)<br />
{<br />
RegCloseKey(hkSub);<br />
return FALSE;<br />
}<br />
else<br />
{<br />
RegCloseKey(hkSub);<br />
return TRUE;<br />
} <br />
}<br />
<br />
return FALSE;<br />
}
Could you help me to fix this bug?
thank you!
|
|
|
|
|
<br />
Student.obj : error LNK2001: unresolved external symbol "public: void __thiscall Student::Quicksort(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *,int)" (?Quicksort@Student@@QAEXPAV?$basic_string@DU?$char_t<br />
raits@D@std@@V?$allocator@D@2@@std@@H@Z)<br />
Debug/Student.exe : fatal error LNK1120: 1 unresolved externals<br />
Error executing link.exe.<br />
<br />
|
|
|
|
|
You're referencing a method called Quicksort(std::string,int) that is defined in one of your headers but isn't actually implemented in one of your .cpp files.
- Mike
|
|
|
|
|
<br />
#ifndef _STUDENT_H<br />
#define _STUDENT_H<br />
<br />
#include <iostream><br />
#include <string><br />
#include "vector.h"<br />
<br />
using namespace std;<br />
<br />
<br />
class Student<br />
{<br />
public:<br />
Student();<br />
string GetName();<br />
void SetInfo(string firstName, string lastName, int SID, int Grade, string Course[], int GradeArr[][6], int i);<br />
void GetGPA();<br />
void GetGrade();<br />
void GetCourseList();<br />
template <typename T><br />
void Quicksort(T a[], int n); <br />
template <typename T><br />
void Quick(T a[], int l, int r);<br />
template <typename T><br />
void print(T a[], int n);<br />
<br />
private:<br />
string sFirstName;<br />
string sLastName;<br />
int iSID;<br />
int iGrade;<br />
int iGradeArr [2][6];<br />
string sCourse [6];<br />
int numCourse;<br />
};<br />
<br />
#endif // _STUDENT_H not defined<br />
<br />
<br />
##########################<br />
#include "student.h"<br />
#include <iostream><br />
#include <string><br />
<br />
using namespace std;<br />
<br />
<br />
<br />
Student::Student()<br />
{<br />
<br />
}<br />
<br />
void Student::SetInfo(string firstName, string lastName, int SID, int Grade, string Course[], int GradeArr[][6], int i)<br />
{<br />
for (int k=0; k< i; k++)<br />
{<br />
sCourse[k]=Course[k];<br />
}<br />
<br />
sFirstName = firstName;<br />
sLastName = lastName;<br />
for (k=0; k< i; k++)<br />
{<br />
iGradeArr[0][k]= GradeArr[0][k];<br />
iGradeArr[1][k]= GradeArr[1][k];<br />
}<br />
iSID= SID; <br />
iGrade= Grade;<br />
numCourse=i;<br />
}<br />
<br />
string Student::GetName()<br />
{<br />
return sFirstName +" "+ sLastName;<br />
}<br />
<br />
void Student::GetGrade()<br />
{<br />
cout<< iGrade<< " "<< iSID<< endl;<br />
<br />
}<br />
<br />
void Student::GetGPA()<br />
{<br />
double iGPA= 0;<br />
<br />
for(int sem1=0; sem1< 2; sem1++)<br />
{<br />
for(int grades=0; grades< numCourse; grades++)<br />
{<br />
if (iGradeArr[sem1][grades] >100)<br />
{<br />
cout<< "A++";<br />
iGPA+=5;<br />
}<br />
else if (iGradeArr[sem1][grades] >= 90)<br />
{<br />
cout<< 'A';<br />
iGPA+=4;<br />
}<br />
else if (iGradeArr[sem1][grades] >= 80)<br />
{<br />
cout<< 'B';<br />
iGPA += 3;<br />
}<br />
else if (iGradeArr[sem1][grades] >= 70)<br />
{<br />
cout<< 'C';<br />
iGPA += 2;<br />
}<br />
else if (iGradeArr[sem1][grades] >= 60) <br />
{<br />
cout<< 'D';<br />
iGPA += 1;<br />
}<br />
else if (iGradeArr[sem1][grades] < 60)<br />
{<br />
cout<< 'F';<br />
iGPA +=0;<br />
}<br />
<br />
}<br />
}<br />
cout<< endl;<br />
cout<< iGPA<< endl;<br />
int totalcredits= 0;<br />
totalcredits +=iGPA;<br />
cout<< iGPA/(numCourse+1);<br />
}<br />
<br />
template <typename T><br />
void Student::GetCourseList()<br />
{<br />
Quicksort(sCourse, numCourse);<br />
}<br />
<br />
template <typename T><br />
T Quicksort(T a[], int n)<br />
{ <br />
<br />
Quick(a, 0, n-1);<br />
<br />
} <br />
<br />
<br />
template <typename T><br />
void Student:: Quick(T a[], int l, int r)<br />
<br />
{ <br />
<br />
if (l >= r) return;<br />
int i, j;<br />
int num_left, num_right;<br />
T pivot, temp;<br />
<br />
while (l < r)<br />
{<br />
i = l;<br />
j = r + 1;<br />
pivot = a[l];<br />
while (true)<br />
{<br />
do<br />
{<br />
i = i + 1;<br />
}<br />
while (a[i] < pivot);<br />
<br />
do<br />
{<br />
j = j - 1;<br />
}<br />
while (a[j] > pivot);<br />
<br />
if (i >= j) break;<br />
temp = a[i];<br />
a[i] = a[j];<br />
a[j] = temp;<br />
}<br />
<br />
a[l] = a[j];<br />
a[j] = pivot;<br />
<br />
num_left = (j-1) - l;<br />
num_right = r - (j+1);<br />
<br />
if (num_left <= num_right)<br />
{<br />
Quicksort(a, l, j-1);<br />
l = j+1;<br />
}<br />
else<br />
{<br />
Quicksort(a, j+1, r);<br />
r = j-1;<br />
}<br />
}<br />
<br />
} <br />
<br />
template <typename T><br />
void Student:: print(T a[], int n)<br />
<br />
<br />
{ <br />
int i;<br />
<br />
for (i = 0; i < n; i++)<br />
{<br />
cout << a[i] << " ";<br />
}<br />
cout << endl;<br />
<br />
<br />
} <br />
##############################<br />
#include <iostream><br />
#include <fstream><br />
#include "vector.h"<br />
#include "student.h"<br />
<br />
using namespace std;<br />
<br />
int main()<br />
{<br />
Vector<Student> Class(6);<br />
<br />
string filename = "student.txt";<br />
ifstream input(filename.c_str());<br />
if (input.fail())<br />
{ cout << "could not open " << filename << " for reading" << endl;<br />
exit(1);<br />
}<br />
<br />
string Course[6], firstName, lastName; <br />
int SID, Grade, GradeArr[2][6];<br />
<br />
int k=0, i=0;<br />
while (!input.eof())<br />
{<br />
input>> firstName>> lastName>> SID>> Grade;<br />
input>> Course[i];<br />
<br />
while(Course[i] != ";")<br />
{<br />
input>> GradeArr[0][i];<br />
cout<< GradeArr[0][i];<br />
input>> GradeArr[1][i];<br />
cout<< GradeArr[1][i];<br />
i++;<br />
input>> Course[i];<br />
<br />
}<br />
Class[k] = Student();<br />
Class[k].SetInfo(firstName, lastName, SID, Grade, Course, GradeArr, i);<br />
k++;<br />
}<br />
cout<< Class[0].GetName()<< endl;<br />
Class[0].GetGrade();<br />
Class[0].GetCourseList();<br />
Class[0].GetGPA();<br />
<br />
<br />
return 0;<br />
}<br />
#################################<br />
<br />
#ifndef _VECTOR_H<br />
#define _VECTOR_H<br />
<br />
#include <cstdlib><br />
#include <cassert><br />
#include <iostream><br />
using namespace std;<br />
<br />
<br />
template <class Item> class Vector<br />
{<br />
public:<br />
Vector()
{<br />
myLength = 0; myList = 0;<br />
}<br />
<br />
Vector(int size)
{<br />
myLength = size;<br />
myList = new Item [size];<br />
assert(myList != 0);<br />
}<br />
<br />
Vector(int size, Item fillValue)
{<br />
myLength = size;<br />
myList = new Item [size];<br />
assert(myList != 0);<br />
for(int k = 0; k < size; k++){<br />
myList[k] = fillValue;<br />
}<br />
}<br />
<br />
Vector(const Vector<Item> & vec)
{<br />
<br />
myList = new Item [myLength = vec.myLength];<br />
assert(myList != 0);<br />
<br />
for(int k = 0; k < vec.myLength; k++)<br />
{<br />
myList[k] = vec.myList[k];<br />
}<br />
}<br />
<br />
~Vector ()
{<br />
delete [] myList;<br />
myList = 0;<br />
myLength = 0;
}<br />
Vector & operator = (const Vector<Item> & vec)
{<br />
if (this != &vec)
{<br />
delete [] myList;
myList = new Item [myLength = vec.myLength];<br />
assert(myList != 0);<br />
<br />
myLength = vec.myLength;<br />
for(int k=0; k < myLength; k++)<br />
{<br />
myList[k] = vec.myList[k];<br />
}<br />
}<br />
return *this;<br />
}<br />
<br />
int Length() const
{<br />
return myLength;<br />
}<br />
int length() const<br />
{<br />
return Length();<br />
}<br />
<br />
void Fill(Item fillValue)<br />
{<br />
int k;<br />
for(k=0; k < myLength; k++)<br />
{<br />
myList[k] = fillValue;<br />
}<br />
}<br />
<br />
void SetSize(int newSize)
{<br />
int numToCopy = newSize < myLength ? newSize : myLength;<br />
<br />
Item * newList = new Item[newSize];<br />
assert(newList != 0);
<br />
int k;<br />
for(k=0; k < numToCopy;k++)<br />
{<br />
newList[k] = myList[k];<br />
}<br />
<br />
delete [] myList;
myLength = newSize;<br />
myList = newList;<br />
}<br />
<br />
void resize(int newSize)<br />
{<br />
SetSize(newSize);<br />
}<br />
<br />
Item & operator [] (int index)<br />
{<br />
if ((unsigned) index >= (unsigned)myLength || index < 0)<br />
{<br />
cerr << "Illegal vector index: " << index<br />
<< " (max = " << myLength-1 << ")" << endl;<br />
assert(index >= 0);<br />
assert(index < myLength);<br />
}<br />
<br />
return myList[index];<br />
}<br />
<br />
const Item & operator [] (int index) const
{<br />
<br />
if ((unsigned) index >= (unsigned)myLength || index < 0)<br />
{<br />
cerr << "Illegal vector index: " << index<br />
<< " (max = " << myLength << ")" << endl;<br />
assert(index >= 0);<br />
assert(index < myLength);<br />
}<br />
<br />
return myList[index];<br />
}<br />
<br />
<br />
private:<br />
Item * myList;
int myLength;
};<br />
<br />
#endif // _VECTOR_H not defined<br />
<br />
<br />
<br />
|
|
|
|
|
today I'm in clinical raven-dead, but I'd check the fact, that:
compiler expects:
Quicksort(std::string,int)
you defines template
T Quicksort(T a[], int n)
couldn't be the array the problem?
What it generates is
std::string Quicksort(std::string a[], int n)
which doesn't actually match the required fn I guess.
But I might be wrong after actualy no-sleeping nigth
|
|
|
|
|
Do I need to have Visual Studio .NET in order to use XP Manifests, or Visual Studio 6.0 is enough?
MSDN explains how to use a manifest and tried it with VS 6.0 but it doesn't work. I still get the old theme.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
|
Thank you very much. Downloading that now.
I created a new project (thru WTL AppWizard) with a manifest, compiled it (no changes made to it), and still I don't have an XP style. Am I missing something?
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
|
thanks.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
I'm writing a small app in visual c++ 6 using MFC. The app uses an Access database to store user info and such.
In the program users can enter a bunch of data into a listbox. The problem is I don't know how much is going to be entered so I can't just create n fields in the database to hold the info.
I tired making a separate table for the ListBox entires and linking the two but searching the tables gets all messed up in my program now. I can't even use the GetTableName() function to find out what table I'm currently is.
Ideas?
|
|
|
|
|
What are you trying to do? How could you possible build a database where you don't know how many fields you would have? Are you building a "database maker"?
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
Would there be any milage in using direct CREATE TABLE SQL, formed dynamically at runtime, prefixing each new table with a unique ID?
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
Hello I am interested in programming a desktop dancer like on mp3dancer.com for a student project and would like to know if anybody would know what programming language i would use and how i would go about it.
Kindest Regards
Pete
|
|
|
|
|
I have seen a book once where they would teach your DirectX programming, and even though I don't know how use DirectX, I think that's what you need to use.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
It appears that you're basically looking to have a set of different pre-rendered animations with connecting frames (or one giant looping animation) and you just want to vary the speed based on the BPM of music being played by other applications.
There are a number of different subprojects involved in this:
- Displaying the animation -- This is probably the simplest part. You can either use DirectDraw (the DirectDraw interface is part of the DirectX 7 interfaces, available for C, C++, VB, and C# in the DirectX 9 SDK), GDI, SDL, Direct3D, or OpenGL. GDI or SDL are probably the easiest way to go here (imho).
- Monitoring music being played -- Maybe try checking out the IDirectSoundCapture8 interface to get started.
- Analyzing the BPM of the music -- Here you'll need to analyze the waveform and derive a beat. I haven't done signal analysis at all, so maybe somebody else can shed some enlightenment.
- Mike
|
|
|
|
|
Hi!
I want to retain only *one* text-format in a CRichEdit derived class of mine. Now if the user paste text into my edit this plan goes not so well.
Then I try something like this:
<br />
BOOL CCalEdit::PreTranslateMessage(MSG *pMSG)<br />
{<br />
BOOL bResult = CRichEditCtrl::PreTranslateMessage(pMSG);<br />
if(pMSG)<br />
{<br />
if((pMSG->message & WM_COPY) == 1 && IsKeyPressed(VK_CONTROL)):-O<br />
{<br />
if(::OpenClipboard(NULL))<br />
{<br />
HANDLE hCB = ::GetClipboardData(CF_TEXT);<br />
if(hCB)<br />
{<br />
LPVOID pCB_Void = (LPVOID)hCB;<br />
LPSTR pCB_String = (LPSTR)pCB_Void;<br />
CString cstrCB(pCB_String);<br />
if(!cstrCB.IsEmpty())<br />
{<br />
HideSelection(TRUE, FALSE);<br />
SetSel(0, -1);<br />
CString cstrThis(GetSelText());<br />
ReplaceSel(cstrThis);<br />
HideSelection(FALSE, FALSE);<br />
}<br />
}<br />
::CloseClipboard();<br />
}<br />
}<br />
}<br />
return bResult;<br />
}<br />
Seems like I got several problems.
a. My -if(...) is not a 100% secure way to determine if a paste op. is in progress - ??? How do I do that?
b. Second - how do I apply my format to the text on the clipboard?
I've have a SetDefaultCharFormat() in my class that I call when I create the edit and it's the job it does that I want to apply also on the text on the clipboars *before* it is pasted in.
I appreciate any idéa.
Ps. There seems to be a LOT of WM_PASTE going ind - after some testing I ended up with: (pMSG->message & WM_COPY) == 1 - don't say it's perfect yet.
Regards,
Michael Mogensen, mm it-consult dk.
><((((º> ·.¸¸.· ><((((º> ·.¸¸.· ><((((º>
|
|
|
|
|
A simpler solution would be to handle the EN_UPDATE notification message, and set all the text in the control to the format that you want. You could try to make it more sophisticated by only changing the text that is new, but since the operations are fairly infrequent (in computer time...), I wouldn't worry.
FYI, EN_UPDATE notification messages are sent after the text changes, but BEFORE the display is updated - a perfect time for changing formatting.
Hope this helps
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
Thanx' sharing the ideas!
And actually it helped this time. What I did was that I made the CHARFORMAT-change to the full selection in response to *not* an UPDATE event but a CHANGE ev. As it turned out an update-ev. came over and over again if I did the work on EN_UPDATE - ON_CHANGE was less sensitive. So this is how the final solution looks:
<br />
const void CCalFrameWnd::CCalendar::Note_EditChange()<br />
{<br />
TRACE(_T("Note_EditChange()\n"));<br />
long lChar_Start = 0, <br />
lChar_End = 0;<br />
CHARFORMAT cf_def;<br />
cf_def.cbSize = sizeof(CHARFORMAT);<br />
m_pEdit_Note->GetDefaultCharFormat(cf_def);<br />
m_pEdit_Note->GetSel(lChar_Start, lChar_End);<br />
m_pEdit_Note->HideSelection(TRUE, FALSE);<br />
m_pEdit_Note->SetSel(0, -1);<br />
m_pEdit_Note->SetSelectionCharFormat(cf_def);<br />
m_pEdit_Note->SetSel(lChar_End, lChar_End);<br />
m_pEdit_Note->HideSelection(FALSE, FALSE);<br />
}<br />
So I just force the def-CHARFORMAT on to the entire selection having always set the def-format first. Also I remember to be able to restore to the orig. caret pos.
It works!
Regards,
Michael Mogensen, mm it-consult dk.
><((((º> ·.¸¸.· ><((((º> ·.¸¸.· ><((((º>
|
|
|
|
|
Michael Mogensen wrote:
As it turned out an update-ev. came over and over again if I did the work on EN_UPDATE
Oops. I forgot to mention that by setting the text formatting, you cause another EN_UPDATE message to be sent, which becomes an endless recursion. You would need to set a static/class-member variable inside the handler and check it when the handler is entered to see if you're already processing the message, and return immediately if you are.
Glad to be of help
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
I need a cross-platform C++ GUI library for a new project I'm working on. Am not particularly thrilled with the current cross-platform library options I've run across. Would like to find a GUI library that works similar to and as easily as a browser, where you can input text and various controls to display on the screen using a hypertext language like HTML or embed instructions for screen layout in the code. Are there any cross-platform C++ GUI library projects in the works that sound similar to this and/or might need another developer
to help out? Are there any new cross-platform C++ GUI projects starting up that might need developers? It would be nice to get involved with a group to work on this rather than my trying to code a new GUI library all by myself. Suggestions appreciated.
Thanks.
Laura
http://www.distasis.com/cpp/
|
|
|
|
|
Have you looked at what the Mozilla team are doing with their XUL stuff.
http://www.mozilla.org/xpfe/[^]
Michael
'War is at best barbarism...Its glory is all moonshine. It is only those who have neither fired a shot nor heard the shrieks and groans of the wounded who cry aloud for blood, more vengeance, more desolation. War is hell.' - General William Sherman, 1879
|
|
|
|
|