|
cheers, I'll give that a try,
Andy,
|
|
|
|
|
thank you, thats solved that problem!!
|
|
|
|
|
Ok...I solved my previous questions.
This question deals with a deleteItem function that is to delete an item from an array. And I am passing a sorted array, its size, and the target element...this is what I have so far...
#include
#include
using namespace std;
template
void sortArray(T arr[], int size);
template
void searchArray(T arr[], int size, T target);
template
void deleteItem(T arr[], int &size, T target);
template
void printArray(T arr[], int size);
int main()
{
int size;
int target;
int arr[10] = {9,8,7,6,5,1,2,3,0,4};
system ("pause");
}
template
void sortArray(T arr[], int size)
{
int smallest;
T temp;
for(int i=0; i {
smallest = i;
for(int j =i+1; j {
if(arr[j] < arr[j-1])
smallest = j;
}
temp = arr[j];
arr[j] = arr[j-1];
arr[j-1] = temp;
}
}
template
void searchArray(T arr[], int size, T target)
{
int size;
int low = 0;
int high = size -1;
int mid = (low + high)/2;
int target;
bool found = flase;
do
{
if(target == arr[mid])
found = true;
else if(target < arry[mid])
high = mid-1; //looks below mid
else
low = mid +1;
if(!found)
{
mid = (low + high)/2;
}
}while (high >= low && !found)
//WHAT DO I RETURN???
}
template
void deleteItem(T arr[], int &size, T target)//only function with pass by reference
{
//PROBLEM HERE!!!!!!?????????
}
template
void printArray(T arr[], int size)
{
for(int i=0; i {
cout << arr[i] << " ";
}
}
Can anybody help me with the delete item method...I'M SO LOST!!!!!
THANK YOU FOR YOUR TIME!
Jason
|
|
|
|
|
on pressing the global hotkey for some time ... I get a lot of WM_HOTKEY messages. But how to notice the release of the hotkey button?
WM_KEYUP Notification (according to msdn) is posted to window with KEYBOARD FOCUS.
but since i have a global hotkey i won't necessarily have keyboard focus.
any suggestions?
|
|
|
|
|
Maybe you can have some sort of variable saying that you are processing the hotkey currently, if you are then return from that message
eg.
ON_WM_HOTKEY()
{
static bool processing = false;
if (processing)
return;
processing = true;
// do some work;
processing = false;
}
|
|
|
|
|
ty but doesnt work;
since on release i dont get a WM_HOTKEY message and
after releasing i wont get in the mentioned function (ON_WM_HOTKEY)
|
|
|
|
|
Hi all,
1) If I drawn a line on SDI client by using MoveTo() and LineTo(). Is there any method to detect which pixel is drawn? I need to get the coordinates of these pixels.
2) Is there any function in MFC that can calculate the distance of a drawn line (or bezier curve) from the starting point to the endpoint?
3) There is a guide in codeproject.com to redraw the drawn lines when the client window is resized/maximized/minimized. I tried and it works however, there are some codes I wrote in OnDraw to draw out the coords/axis of the client. These drawing from OnDraw is covering my META redrawn line. Please advise.
THanks a million.
|
|
|
|
|
1) There's the CDC::GetPixel(), which can give you the color of a pixel knowing its coordinates, But I'm not sure it's what you want. You can still use the good old geometric equations, knowing two points you know the equation of the line, so the coordinates of all the points of the line.
2) Not at my knowledge. The length of a segment is given by the formula length = sqr((endpoint.x - startpoint.x)*(endpoint.x - startpoint.x) + (endpoint.y - startpoint.y)*(endpoint.y - startpoint.y)). Calculating the length of a bezier curve is a little trickier, you may find a good approximation here[^].
3) Make all your drawings in your OnDraw method, and begin to draw items who are "behind" at first.
Fold With Us!
War is too serious a matter to entrust to military men - Georges Clémenceau (1841-1929)
|
|
|
|
|
Thanks K(arl),
The program I need to write:
1st) User is required to draw a simple curve on the client.
2nd) The algorithm will scan the SDI client screen to find all the drawn coords on row/col basis. You have suggested to use CDC::GetPixel().
3rd) Once a drawn pixel is found it will perform a 3x3 matrix check to determine the "connectivity" of this pixel. http://img52.exs.cx/img52/2303/3x3matrix.gif[^]If there are other drawn pixels in this 3x3 matrix, the drawn pixel is not an island.
4th) The program will keep scanning in loop to get to the end point of the curve. From there, the program will mark down a point for each specific distance of pixels. http://img40.exs.cx/img40/513/curve.gif[^] That is why I asked is there any function to check distance between endpoint to endpoint of a curve.
My problem:
1) Is there a better way than my algorithm? Anyone has a better idea to scan pls reply here. My method is very tedious. THanks.
2) If there is an intersection such as the two curves intersection point. The program will be bugged (I foresee).
Thanks a million
|
|
|
|
|
does the code
BYTE m_byte:5 ;
set the number of bits in m_byte to 5? if so, would this line:
BYTE ret:nCodeSize = *lpBufComp;
read nCodeSize number of bits from the buffer lpBufComp? the last question is this: after having done this, how would i move the pointer lpBufComp along to the next unread bit?
|
|
|
|
|
More or less, look the exact syntax up in a book like I would.
As for your second question, what I've done is something like:
struct Data {
BYTE FirstFive:5;
BYTE LastThree:3;
}
Data In;
readByte(&In);
useFiveBits(In.FirstFive);
useThreeBits(In.LastThree);
or something like that.
|
|
|
|
|
i want to call/make incoming connection dialog with mfc vis.c++
i can call connection wizard using ras api, but there's no choice
for make an incoming connection.
i use incoming connection for accept a call from ras client.
i want to set incoming connection programmatically like we set ras api.
so, can anybody help me?
by the way thanks for any help for this problem........
|
|
|
|
|
hi all
how can i send a voice file(playing )to another computer over network with visual c++ ?
like voice chat . but this is a voice file . i want to play it and send it to another computer
|
|
|
|
|
you could use directplay or you just code your own audio streaming library... it is not difficult!
Don't try it, just do it!
|
|
|
|
|
Hi Everyone,
This might be sound very obvious to many of you, but being very inexperienced, and working on a short deadline, I really need to get some help. If someone can direct me on this issue, I would really appreciate it.
I have a very simple C++ programming where 20 files are given in one directory. I am to
1) Open all the files up, 2) loop through all the lines in each file 3) identify a specific word that was entered by the user. 4) Output the file name and the line that contains the word.
The output of the program would look like this.
Search word : Lisa How
Here are the results:
File A : Lisa How is nice
FileB : here is lisa how
File C: where is lisa how
.....
File 100 : I am lisa ...
... and so on.
The logic seems to be simple, but I am every inexperienced with this kind of work. I have started some code, but nothing too far
Please let me know
Thx!!!
Ps, I hope I have explained the issue clearly.
THX!!!
|
|
|
|
|
Does anyone know some docs or good exemples about VMR9?
The point is to get a pointer to the overlay surface and to save the current image to be displayed.
In fact I need to make a screenshot (so making a capture outside the application).
Could I have an indication about how to do this?...
|
|
|
|
|
Hello,
I need to insert Icons and text på a listbox byt it need to be icons that are 16*16 not 32*32. Is there anyone that can help me please.
|
|
|
|
|
how can i RELIABLY backup and restore the registry
through my program
it should work on NT and 9X
thanks
|
|
|
|
|
RegSaveKeyEx and RegRestoreKey , I think.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
ppl tell me RegRestoreKey is not available on win9X
|
|
|
|
|
Those people are correct. On Windows 9x, the registry consists of the system.dat and user.dat files, which are located in the Windows folder. Read MSDN article Q132332 for more.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Does anyone know a quick, easy and free way to get a list of all the exports from a DLL?
Joel Holdsworth
|
|
|
|
|
I assume in your instance Depends.exe is out of the question!?
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
dumpbin /exports
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Hi All,
I am working with a custom titlebar. I want to get the current size of the close button and set the value for the button which i am drawing. The problem is, if i put the left point in a CRect as
pCapRect->left = rcWindow.Width()-(sizeButton.cx);
and draw the close button using
pDc->DrawFrameControl(pCapRect, DFC_CAPTION, DFCS_CAPTIONCLOSE); // For Close
the left position (also the size) is not getting aligned with the default close button(which shows up), when i change from one skin to another.
Awaiting your reply
|
|
|
|