|
Assertion Error!!!
Where u writing the code
OnCreate or OnShowWindow()????
|
|
|
|
|
Hi
I m using splitterwndow.
left view consists of treeview with various items..
right view contains frame windows that appears when cliking an item in treeview..
With this type we can use our listcontrol right?
|
|
|
|
|
Hi,
How to remove menu of a running application through another application?
|
|
|
|
|
I am trying to establish TCP/IP communication between DSP board(that runs Code Composer Studio, an IDE to compile and run C code) and host PC(that runs VC++ application)
While sending the data from CCS to VC, sometimes "Retransmission Timeout" error occurs, and at other instance "Persist Timeout" occurs, after this timeout the transmission stops.
How to address these errors in VC++ MFC code. (CAsyncSocket class and the member functions are used for reception of data at VC++ end)
|
|
|
|
|
suchithra, from your post, I can understand the problem wel, but you didn't mentioned whether you were using any wired/wireless communication. Look, I have done so many programs for interfacing, establishments of communications for different mechatronic devices etc. & faced lots of probs. The best practice would be throughing Exceptions, so that you can understand where the problem is. I rather suggest you-
1. Use UDP protocol other than using TCP/IP protocol.
2. If you are sending bulk data, then check for stack overflow
3. Try to Impliment of your own timeout block or extend socket timeout value
4. Swap your globally stored data to local veriable, so that before every recieve, your global block should be cleaned.
5. Check your h/w connection for communication.
"Retransmission Timeout" error occurs:
1. It means either no data is being recieved by your VC++ aps(use Exceptions to check atallit recieve any data from sender or not) or it recieves few data, after that communication lost (cause by stack overflow/ h/w issue), which is quite obvious in TCP/IP protocol for large data transfer. Use UDP only.
|
|
|
|
|
I have been working with GLSL for a couple days and I understand the basic concept. I know how to get specific values from my openGL applicaiton to the shader but I don't know how to pass in my own variables. I appreciate your help with this problem.
|
|
|
|
|
Could you be more specific, please?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I know that values such as light position can be passed into either the fragment shader or the vertex shader using gl_lightsource, but what if I wanted to use a variable from my code such as an eye vector for a phong equation. In the information on GLSL I have read I have not seen a mention as to how to do something like this. All I have seen is being able to pass data in that would normally be used in OpenGL's lighting model, such as the functions glMaterialfv and glLightfv. I hope this better explains my problem.
|
|
|
|
|
Been a couple years but IIRC ...
If you have a vertex shader with:
attribute float myAttrib;
Then in the C++ source you would:
GLint loc = glGetAttribLocation(progId, "myAttrib");
or,
GLint loc = 20;
glBindAttribLocation(progId, loc, "myAttrib");
then to set myAttrib,
glVertexAttrib1f(loc, 0.432);
So you can set per-vertex in C++ and read (only) in shader.
... uniforms are similar.
If you want to bind then do so after glAttachShader and before glLinkProgram.
I think OpenGL 3+ changes the above slightly, haven't gotten up to speed on it yet.
...cmk
The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack
|
|
|
|
|
Thank you, this has been very helpful, I just have one more question; what about vec3, vec4, etc. This might be a stupid question, there might be a data structure in opengl that can handle data from these types, but what do i do about these data types?
|
|
|
|
|
glBindAttrib*() has versions that accept all types of values.
See examples at: http://www.lighthouse3d.com/opengl/glsl/index.php?ogluniform[^]
...cmk
The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack
modified on Wednesday, April 21, 2010 2:29 PM
|
|
|
|
|
BOOL result = tb->CreateEx( this
,TBSTYLE_TRANSPARENT | TBSTYLE_FLAT
,WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ,toolBarBorder
,TB_ID);
For some reason this crashes in release mode but not debug, where should I be looking for some un-initialized pointers. I can't seem to isolate where it is happening. Can anyone give me some pointers? Using VS2008, by the way no crashes in release or debug in VS2003
Thanks
Ray
|
|
|
|
|
First thing, when you build a release build you should still include debug information. Using Visual Studio 2008: the "Debug Information Format" setting in C++ node of the project properties should be set to "Program Database (/Zi)" for release builds (and "Program Database for Edit & Continue(/ZI)" on debug builds); On the "Linker->Debugging" node set "Generate Debug Info" to "Yes". Once you've got all that set-up debug the program as you normally would - you can't trust the debugger as much as you can in a release build, but all generally works well.
Steve
|
|
|
|
|
|
How to find out exception type in the unexpected exception handler
|
|
|
|
|
GetExceptionInformation[^] combined with typeid (if it has virtual functions) are your best shot for a simple solution; otherwise you may want to look up some articles on exception handling for C++.
|
|
|
|
|
I have a CFormView with several pages. For some reason, if I use
the mouse wheel, a page will scroll up and down using the mouse
wheel. For other pages, the mouse wheel doesnt work. I have studied
the 2-pages ad nausem and I cant figure out what is different from
one page to the other; why one page uses the mouse wheel and the
other doesnt.
Any ideas? Any direction any one can give me will be greatly
appreciated.
Sincerely,
Danielle Brina (an overworked graduate student)
|
|
|
|
|
Check if your CFormview still owns the scrollbar. If not, no scrolling.
Also there is a bug in MFC 7.1 and 8.0 which can cause this behaviour. If all else fails implement your own ::OnMouseWheel.
|
|
|
|
|
Normally the View should scroll by default. Mostly you have such problem when you have some control over the form, you will need to handle Scroll messages in the control in this case.I can scroll with the wheel in a CFormView application. If no controls is placed in your form too, then I suggest you to try your application on a different machine, see if there is any changes?
|
|
|
|
|
in my Pocket PC (MFC VS2009) app, I am trying to open/read a txt file, but most of the read file commands are not included. The only one seems to work for me is ReadFile, which is not that easy to use if I want to read lines of text.
Any ideas?
|
|
|
|
|
Please get and try the class on the bottom of the article[^]
virtual void BeHappy() = 0;
|
|
|
|
|
|
Software2007 wrote: Any ideas?
Can you use fopen() and fscanf() ?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
I got DLL injection example from youtube. http://www.youtube.com/watch?v=H3O3hmXkt1I
For some reason it says: "Injection failed" (under indows 7) and under win xp this exe doesn't even start (i see msgbox telling me to reinstall this app).
It compiles w/o errors
Injector.exe
#include <iostream><br />
#include <direct.h><br />
#include <windows.h><br />
#include <tlhelp32.h><br />
using namespace std;<br />
<br />
char* GetCurrentDir()<br />
{<br />
char* szRet = (char*)malloc(MAX_PATH);<br />
<br />
_getcwd(szRet, MAX_PATH);<br />
<br />
return szRet;<br />
}<br />
<br />
LPCTSTR SzToLPCTSTR(char* szString)<br />
{<br />
LPTSTR lpszRet;<br />
size_t size = strlen(szString)+1;<br />
lpszRet = (LPTSTR)malloc(MAX_PATH);<br />
mbstowcs_s(NULL,lpszRet,size,szString,_TRUNCATE);<br />
return lpszRet;<br />
}<br />
<br />
void WaitForProcessToAppear(LPCTSTR lpcszProc, DWORD dwDelay)<br />
{<br />
HANDLE hSnap;<br />
PROCESSENTRY32 peProc;<br />
BOOL bAppeared = FALSE;<br />
<br />
while (!bAppeared)<br />
{<br />
if((hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0)) != INVALID_HANDLE_VALUE)<br />
{<br />
peProc.dwSize = sizeof(PROCESSENTRY32);<br />
if(Process32First(hSnap, &peProc))<br />
while(Process32Next (hSnap, &peProc) && !bAppeared)<br />
if(!lstrcmp(lpcszProc, peProc.szExeFile))<br />
bAppeared = TRUE;<br />
}<br />
CloseHandle(hSnap);<br />
Sleep(dwDelay);<br />
}<br />
}<br />
<br />
DWORD GetProcessIdByName(LPCTSTR lpcszProc)<br />
{<br />
HANDLE hSnap;<br />
PROCESSENTRY32 peProc;<br />
DWORD dwRet = -1;<br />
<br />
if((hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0)) != INVALID_HANDLE_VALUE)<br />
{<br />
peProc.dwSize = sizeof(PROCESSENTRY32);<br />
if(Process32First(hSnap, &peProc))<br />
while(Process32Next (hSnap, &peProc))<br />
if(!lstrcmp(lpcszProc, peProc.szExeFile))<br />
dwRet = peProc.th32ProcessID;<br />
}<br />
CloseHandle(hSnap);<br />
return dwRet;<br />
}<br />
<br />
BOOL InjectDLL(DWORD dwPid, char* szDllPath)<br />
{<br />
DWORD dwMemSize;<br />
HANDLE hProc;<br />
LPVOID lpRemoteMem, lpLoadLibrary;<br />
BOOL bRet = FALSE;<br />
<br />
if((hProc = OpenProcess(PROCESS_VM_OPERATION | PROCESS_VM_WRITE | PROCESS_CREATE_THREAD, FALSE, dwPid)) != NULL)<br />
{<br />
dwMemSize = strlen(szDllPath) +1;<br />
if((lpRemoteMem = VirtualAllocEx(hProc,NULL,dwMemSize,MEM_COMMIT,PAGE_READWRITE)) != NULL)<br />
if(WriteProcessMemory(hProc, lpRemoteMem, (LPCVOID)szDllPath,dwMemSize,NULL))<br />
{<br />
lpLoadLibrary = GetProcAddress(GetModuleHandleA("kernel32.dll"), "LoadLibraryA");<br />
if(CreateRemoteThread(hProc, NULL, 0, (LPTHREAD_START_ROUTINE)lpLoadLibrary, lpRemoteMem, 0, NULL) != NULL)<br />
bRet = TRUE;<br />
}<br />
}<br />
CloseHandle(hProc);<br />
<br />
return bRet;<br />
}<br />
<br />
int main()<br />
{<br />
char szProc[MAX_PATH],szDll[MAX_PATH];<br />
char* szDllPath = (char*)malloc(MAX_PATH);<br />
LPTSTR lpszProc = NULL;<br />
for(;;)<br />
{<br />
cout << "Proccess: ";<br />
cin >> szProc;<br />
cout << "DLL: ";<br />
cin >> szDll;<br />
szDllPath = GetCurrentDir();<br />
strcat_s(szDllPath,MAX_PATH,"\\");<br />
strcat_s(szDllPath,MAX_PATH,szDll);<br />
cout << "Waiting for process..." << endl;<br />
WaitForProcessToAppear(SzToLPCTSTR(szProc), 100);<br />
if(InjectDLL(GetProcessIdByName(SzToLPCTSTR(szProc)),szDllPath))<br />
cout << "Injection succeeded!" << endl;<br />
else<br />
cout << "Injection failed!" << endl;<br />
cout << "\n";<br />
}<br />
<br />
return 0;<br />
}
test.dll
#include <windows.h><br />
<br />
BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwReason, LPVOID lpReserved)<br />
{<br />
switch(dwReason)<br />
{<br />
case DLL_PROCESS_ATTACH:<br />
MessageBox(0, L"I'm injected!",L"injxOrz", MB_OK);<br />
}<br />
<br />
return TRUE;<br />
}
any ideas?
|
|
|
|
|
Try to run the code with administrator privileges.
|
|
|
|
|